[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
Sat Feb 19 03:58:18 UTC 2022


Hi,
Can you please help ?
I see that in OnFailure behaviour is changed and these units in OnFailure
gets triggerd when service is failed-and-will-not-restart-automatically.
https://lists.freedesktop.org/archives/systemd-devel/2018-June/040879.html
In such case, does systemd also send dbus signal  whenever it triggers
OnFailure ?
Thanks


On Fri, Feb 18, 2022 at 8:55 PM Prashantkumar dhotre <cdprashanth at gmail.com>
wrote:

> 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/20220219/affb7c42/attachment.htm>


More information about the systemd-devel mailing list