[systemd-devel] reacting to unit failures (OnFailure)
Nekrasov, Alexander
alexander.nekrasov at emc.com
Thu Dec 4 13:17:22 PST 2014
If I may go back to RestartSec, this gives me an ability to sleep before attempting to restart. I could see where I might use that, but I also need another ability, which is to stop restarting a service if it keeps failing, and trigger OnFailure instead.
Upstart has a respawn limit, something like 3 restarts in 180 seconds, and if it still fails after that - the job goes to "failed" state and is left stopped. Can I do the same with SystemD?
> -----Original Message-----
> From: "Jóhann B. Guðmundsson" [mailto:johannbg at gmail.com]
> Sent: Tuesday, December 02, 2014 10:28 AM
> To: Nekrasov, Alexander; systemd-devel at lists.freedesktop.org
> Subject: Re: [systemd-devel] reacting to unit failures (OnFailure)
>
>
> On 12/02/2014 03:12 PM, Nekrasov, Alexander wrote:
> > Lennart just gave me a solution, thank you. I'll use templates
> >
> > I have a system where components at the "single node" level have
> dependencies and HA policies, such as "restart this many times within
> this interval, if still fails - run this action" where action is a
> sequence of commands. Components provide this information in their own
> language and I have to generate systemd configuration for them. It's
> more complex than just rebooting the node so I couldn't use
> FailureAction.
>
> Right but you already have
> Restart=on-failure
> RestartSec=...
>
> and the likes to restart the services in graceful HA manner ( and at the
> sametime allowing it to fail gracefully ) so what I was curious about
> what else you are doing in the background since it might lead to a worse
> situation in HA setup by doing so depending on the HA setup ( split
> brains etc you know the drill ).
>
> JBG
More information about the systemd-devel
mailing list