Get the PID of a given systemd unit:
$ systemctl show --property MainPID --value $SERVICE my-foo-service
22172
It’s nice and less error prone to a have a stable API for getting this rather than pgrep
/grep
/sed
/awk
ing it.
#linux
Get the PID of a given systemd unit:
$ systemctl show --property MainPID --value $SERVICE my-foo-service
22172
It’s nice and less error prone to a have a stable API for getting this rather than pgrep
/grep
/sed
/awk
ing it.
#linux