I have a aaa.service
file (controlling the JBoss), that besides other regular stuff contains
[Service]
Type=forking
ExecStart=/my/script start
ExecReload=/my/script restart
ExecStop=/my/script stop
PIDFile=...
/my/script start
creates the PID-file and service aaa status
shows it issuing a strange warning:
Supervising process xxx which is not our child. We'll most likely not notice when it exits.
Full output:
Loaded: loaded (/etc/systemd/system/aaa.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2019-01-22 20:55:16 CET; 34min ago
Process: 32435 ExecStart=/my/script start (code=exited, status=0/SUCCESS)
Main PID: 32542
Tasks: 0 (limit: 512)
CGroup: /system.slice/aaa.service
Jan 22 20:54:56 I011-830 su[32447]: (to aaa) root on none
Jan 22 20:54:56 I011-830 su[32447]: pam_unix(su-l:session): session opened for user aaa by (uid=0)
Jan 22 20:55:16 I011-830 aaa[32435]: Starting JBoss application server: Starting JBoss application server:
Jan 22 20:55:16 I011-830 systemd[1]: aaa.service: Supervising process 32542 which is not our child. We'll most likely not notice when it exits.
Now my actual problem is, that if the process get killed other then by issuing service aaa stop
, the systemd doesn't detect it. Even more it claims, that it's running and don't want to start it again:
# cat <pid-file>
No such file or directory
# service aaa status
Loaded: loaded (/etc/systemd/system/aaa.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2019-01-22 20:55:16 CET; 40min ago
Process: 32435 ExecStart=/konsens/app/aaa/init/aaastart (code=exited, status=0/SUCCESS)
Main PID: 32542
Tasks: 0 (limit: 512)
CGroup: /system.slice/aaa.service
...
# service aaa start
# <--- Instant return, no process started
How can I achieve following goals?
- systemd should be able to start and stop my service
service aaa status
should show the status of the process regardless if it was started by systemd or manually issuing/my/service start
- systemd should be able to start service after it was killed manually
- systemd should be able to stop service, that I have started manually