I run a custom service with a classic init script on Debian Jessie. Debian Jessie uses systemd. The reason that I use an init script is that I also use the same service on Debian Wheezy, which does not have systemd.
Since the service may crash occasionally, I want it to be relaunched when it stops. My understanding is that systemd will take care of this. However, when I manually kill the service (without systemctl stop service
), systemctl status
will report the service as active (exited)
.
It is my understanding that this means that systemd simply considers the service to be one that can be "running" without having an process. The documentation mentions RemainAfterExit
as a way to configure this behaviour, but this is a flag for use in a unit-file, I only have an init script.
Is there a way to let systemd know that an init service needs a process to be considered active? In other words, let it know that active (exited)
is an undesired state?
I solved the problem by writing a generic boilerplate systemd unit file. Store the file in
/etc/systemd/system/$SERVICE.service
.Replace
$SERVICE
with the service name.Run
systemctl daemon-reload
to refresh systemd's internals.