[systemd-devel] StartLimitAction Feature

Usman desert03 at yahoo.com
Fri Feb 28 09:15:04 PST 2014


Thanks Lennart. Just a follow up question, can we get the "result" from the Agent Released message on the dbus somehow? Or which message should I be listening on dbus for this?



On Thursday, February 27, 2014 5:14 PM, Lennart Poettering <lennart at poettering.net> wrote:
 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140228/60b6a7bc/attachment.html>


More information about the systemd-devel mailing list