systemd / pystemd

A thin Cython-based wrapper on top of libsystemd, focused on exposing the dbus API via sd-bus in an automated and easy to consume way.
GNU Lesser General Public License v2.1
414 stars 36 forks source link

Service.MainPID is zero #92

Closed tyctor closed 5 months ago

tyctor commented 5 months ago

hi

i am trying to create simple monitor of icecast service, is there reason why pystemd is returning Service.MainPID always 0 ?

In [2]: unit = Unit("icecast2.service", _autoload=True)
In [3]: unit.Service.MainPID
Out[3]: 0
systemctl status icecast2.service 
● icecast2.service - LSB: Icecast2 streaming media server
     Loaded: loaded (/etc/init.d/icecast2; generated)
     Active: active (running) since Sun 2024-04-14 20:46:21 UTC; 44min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 2091674 ExecStart=/etc/init.d/icecast2 start (code=exited, status=0/SUCCESS)

real PID:

pidof icecast2
2091678