[systemd-devel] StartLimitAction Feature
Lennart Poettering
lennart at poettering.net
Thu Feb 27 17:14:06 PST 2014
On Wed, 26.02.14 11:59, Usman (desert03 at yahoo.com) wrote:
> Hi Guys,
>
>
>
> I am getting started with systemd and am looking for a particular
> answer. I know the config option "StartLimitAction=" will have a
> pre-set option to choose from. It either restarts the box or so. But I
> want to do something else as well. For example I want to execute a
> script when rate limit configured and burst level is hit. Is there a
> way to do that? Specifically I am looking for any message/event that I
> can see on dbus etc to know that tha restart rate limit is hit and
> we're restarting the box or just plainly stopping application (no more
> restarts). Any way to do that?
You can invoke another service with OnFailure= as soon as your service
fails. Then, you can pull the failure reason out of the original service
via the bus and act on it.
OnFailure=failure-handler@%p.servince
and then in failure-handler at .service you take %i and use your own bus
client or "systemctl show -p" to query the "Result" property which will
tell you the reason the unit failed.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list