[systemd-devel] How to get notified on service state change

Pradeepa Kumar cdpradeepa at gmail.com
Thu Oct 8 18:22:07 PDT 2015


Hi systemd-experts,

I am writing a daemon which starts, stops and monitor services and I am
using dbus to interface with systemd. I send messages on dbus to start or
stop the service and this is working well. I want to achieve the following:



1) Monitor service exit using the systemd dbus interface.

2) Monitor when the service has entered a failed state



I am trying to understand what is the right mechanism to implement this
using the systemd dbus interface, I have tried a few things clearly I don’t
understand how this works, any help greatly appreciated.



I am looking for way to know when service stopped or failed so that i can
take some action in my monitoring app.

I am listening to PropertiesChanged signal and query ActiveState property
to get new value. This does not work always.
Some times, unit is unloaded before I query the ActiveState.
Do we get new values of property along with PropertiesChanged signal in new
version of systemd?
if yes in which version this feature was added ?
What is the best way to achieve my requirement ?

Appreciate your help on above queries



Thanks

Prashant
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20151009/cc6094ca/attachment.html>


More information about the systemd-devel mailing list