[systemd-devel] From dbus notification, how to know service entered failed state and will not start without admin action

Prashantkumar dhotre cdprashanth at gmail.com
Fri Feb 18 15:25:47 UTC 2022


Hi,
In my app, I am monitoring a few services and would like to do some cleanup
in my app, when these services  fail in such a way that they don't restart
back up without admin action.
>From  dbus-monitor , I see that 'Result' dbus PropertiesChanged signal
comes first and then 'ActiveState' PropertiesChanged signal comes next.
I was hoping that to use   'ActiveState' = "failed"  and "SubState" =
"failed" but that does not satisfy my requirement as
when I  send sigkill  i get "ActiveState" and "SubState" as "failed" in
DBus notification but service starts back up automatically (due to
'Restart' &  'ActiveState'settings )
Also when app exits with non-zero code also , I get "ActiveState"
and "SubState" as "failed" in DBus notification.
So I can not use only  "ActiveState" and "SubState" values , as app
restarts after these states report "failed" (in which case my app should
not do cleanup)
Using dbus notification, how can determine that service is down and not
going to start automatically so that in my app i can do cleanup ?
Is there any parameter in PropertiesChanged  signal that tells that app is
down and will not start back up automatically ?
I am using systemd 243.
Thanks for your help.
Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20220218/8454fe50/attachment.htm>


More information about the systemd-devel mailing list