[systemd-devel] reacting to unit failures (OnFailure)

Lennart Poettering lennart at poettering.net
Thu Dec 4 15:39:54 PST 2014

On Thu, 04.12.14 16:17, Nekrasov, Alexander (alexander.nekrasov at emc.com) wrote:

> 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?

Yes, see StartLimitInterval=, StartLimitBurst=


Lennart Poettering, Red Hat

More information about the systemd-devel mailing list