Re: [systemd-devel] How to dynamically retrieve my service name?

2020-11-10 Thread Etienne Doms
Ok it seems /org/freedesktop/systemd1/unit/self is exactly what I was looking for. Thank you for your fast response. Le mar. 10 nov. 2020 à 18:23, Mantas Mikulėnas a écrit : > > You can call org.freedesktop.systemd1.Manager.GetUnitByPID() to directly get > the D-Bus object path based on your

Re: [systemd-devel] How to dynamically retrieve my service name?

2020-11-10 Thread Mantas Mikulėnas
You can call org.freedesktop.systemd1.Manager.GetUnitByPID() to directly get the D-Bus object path based on your PID. There is also the magic path "/org/freedesktop/systemd1/unit/self" which always gives properties of the same service (or scope) that you're in. Finally, it is possible to call

[systemd-devel] How to dynamically retrieve my service name?

2020-11-10 Thread Etienne Doms
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