Hello,

My service needs to behave a bit differently when it has been
automatically because of a software fault. I use the
"Restart=on-failure", and I understand that I can read the "NRestarts"
property which is incremented whenever the service is restarted.

The thing is, inside my service, I have no idea if I'm foobar.service,
barfoo.service, etc. and I believe I should be agnostic of that.

Is there a way to dynamically retrieve
/org/freedesktop/systemd1/unit/foobar_2eservice, so that I can ask
org.freedesktop.systemd1 the NRestarts property value of the
org.freedesktop.systemd1.Service interface?

Maybe I'm just over-engineering and should just hardcode
"foobar.service" inside my service, but it feels a bit odd to me...
Maybe also I understand nothing about D-Bus, sorry about that.

Thank you for your support.

Best regards,
Etienne Doms
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to