I have ported my LSB-controlled daemon to systemd using a wrapper script that starts and stops the daemon. My systemd (multi-instance) service file uses Type=forking
, ExecStart=...
, ExecStop=...
, and PIDFile=...
.
When starting, everything looks OK in systemd, but stopping always seems to fail. As in the LSB environment this worked fine, I suspected systemd (228) to do something bad.
Actually I found out that after a successful start the PIDfile is gone, so my wrapper script returns with exit code 1 (as the PID file could not be found where expected).
So does systemd really remove the PID file? The side effect is that systemd seems to kill my daemon hard after the wrapper-script returned an error.