Returns the current ServiceStatus of a systemd unit.
Checks with command -v first — returns "not-installed" when the unit binary is absent. Then calls systemctl is-active and maps the output to a ServiceStatus value.
command -v
"not-installed"
systemctl is-active
The systemd unit name (e.g. "nginx.service").
"nginx.service"
Returns the current ServiceStatus of a systemd unit.
Checks with
command -vfirst — returns"not-installed"when the unit binary is absent. Then callssystemctl is-activeand maps the output to a ServiceStatus value.