Closed Kunsi closed 4 years ago
hello!!... so we do have support for user units, but its kind of hidden... here is and example
import pystemd
from pystemd.dbuslib import DBus
In [12]: with DBus(user_mode=True) as bus, pystemd.systemd1.Unit("dotsync-poll.service", bus=bus) as service:
...: print(service.ExecStart)
...:
[(b'/usr/lib/dotsync/poll', [b'/usr/lib/dotsync/poll'], False, 1580064070114529, 11690243008440, 1580064080617836, 11690253511747, 2523869, 1, 0)]
you need to create a user dbus, and then pass it to the service...
there are things to support machine buffer and local ad-hoc sockets in case you are interested :D
hope this helps... and please let us know how it goes with the implementation!! :)
Found this issue while seeking the exact same thing. Your response might be a good thing to copy somewhere into the readme/docs for others who also use user units.
I would like to integrate this into my i3pystatus config to show if redshift.service is active. However this Library does not seem to allow to check user services.