[root@localhost etc]# systemctl status blu_av
● blu_av.service - avscan
Loaded: loaded (/etc/systemd/system/blu_av.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2018-03-16 16:31:14 IST; 3s ago
Main PID: 31934 (av)
CGroup: /system.slice/blu_av.service
├─31934 /opt/services/av
└─31956 /opt/services/av
Mar 16 16:31:14 localhost.localdomain systemd[1]: Started avscan.
Mar 16 16:31:14 localhost.localdomain systemd[1]: Starting avscan...
If the above is the output of my status. I want to retrieve the service name, uptime and status by using a python script.
systemd
services have a whole list of properties. To get the start time for example; you could run:
systemctl show your.service --property=ActiveEnterTimestamp
which would give something like:
ActiveEnterTimestamp=Fri 2019-05-03 09:35:02 CEST
To see the list of all properties; just run
systemctl show your.service
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With