I have a backup daemon running on my server that's crashing every few days. I'm not sure why. In the long run I'd like to figure out why and fix it, but in the mean time I'd like systemd to restart it when it crashes.
It has an old-style SysV init script, which is being picked up by systemd-sysv-generator. Apparently when it crashes it does so with a zero ("successful") exit code. To try to get it to restart after these crashes, I dropped in an override.conf:
~$ cat /etc/systemd/system/crashplan.service.d/override.conf
[Service]
Restart=always
systemd does appear to be picking this up:
roberts:~$ sudo systemctl show crashplan.service | grep Restart
Restart=always
RestartUSec=100ms
Nonetheless, when I checked on it after a few days, I found:
roberts:~$ sudo systemctl status crashplan.service
● crashplan.service - LSB: CrashPlan Engine
Loaded: loaded (/etc/init.d/crashplan; bad; vendor preset: enabled)
Drop-In: /etc/systemd/system/crashplan.service.d
└─override.conf
Active: active (exited) since Thu 2017-01-05 00:33:50 PST; 5 days ago
Docs: man:systemd-sysv-generator(8)
Jan 05 00:33:50 roberts systemd[1]: Stopped LSB: CrashPlan Engine.
Jan 05 00:33:50 roberts systemd[1]: Starting LSB: CrashPlan Engine...
Jan 05 00:33:50 roberts crashplan[25491]: Starting CrashPlan Engine ... Using standard startup
Jan 05 00:33:50 roberts crashplan[25491]: OK
Jan 05 00:33:50 roberts systemd[1]: Started LSB: CrashPlan Engine.
So... systemd seems to think that it's not running and that's cool? There are no logs suggesting that it even tried to restart it? I can't even figure out how to tell when it crashed. What's going on here?
override.confso it hasRestart=always,PIDFile=/opt/crashplan/CrashPlanEngine.pid,RemainAfterExit=no, and we'll see if that helps... – Nathaniel J. Smith Jan 10 '17 at 23:18Restart=always,PIDFile=/var/run/jenkins/jenkins.pid, andRemainAfterExit=nodid the trick. – Douglas Manley Dec 27 '17 at 16:43