I have a simple systemd service that needs to be periodically restarted to keep its process from bugging out. Is there a configuration option for systemd services to periodically restart them? All of the Restart*
options seem to pertain to restarting the service when it exits.
This may not have been present at the time the question was asked, but for systemd version >= 229, there is an option called RuntimeMaxSec
, which terminates the service after it has been running for the given period of time.
e.g.
[Service]
Restart=always
RuntimeMaxSec=604800
To me this seems more elegant than abusing Type=notify
and WatchdogSec
.