[Tutor] systemd

David Rock david at graniteweb.com
Sun Mar 3 20:16:04 EST 2019


> On Mar 3, 2019, at 08:46, Dave Hill <dave at the-hills.org.uk> wrote:
> 
> 
> I would like to take advantage of the 'restart' functionality, but I still wish to have a method of exiting
> 
>   i.e. Restart=always
> 
> Is there a way in which I can have automatic restart but also have a way of exiting?
> 

Maybe “always” is not what you want.  If you use “on-failure" instead, it will restart in all cases except when it cleanly exits.

From systemd.service manpage:
https://manpages.debian.org/jessie/systemd/systemd.service.5.en.html

"Setting this to on-failure is the recommended choice for long-running services, in order to increase reliability by attempting automatic recovery from errors. For services that shall be able to terminate on their own choice (and avoid immediate restarting), on-abnormal is an alternative choice.”

You will also see a table of what each setting does, to help you pick the best option for your needs.


You might also want to set the RestartSec to something other than zero.  If you set it to something like 20 seconds, it would also give you time to manually disable the service if you needed to.


— 
David Rock
david at graniteweb.com






More information about the Tutor mailing list