services supports systemd

Adds support for systemd services to the services script. Tested on
Debian 10.
This commit is contained in:
Mark King 2020-04-12 20:23:22 +01:00
commit 164ce485eb

View file

@ -24,7 +24,17 @@ __services_detail() {
}
service_running() {
if [ -f "/etc/init/$1.conf" ]; then
if [ -f "/sbin/service" ]; then
# Use systemd
case "$(/sbin/service $1 status 2>/dev/null)" in
*running*)
true
;;
*)
false
;;
esac
elif [ -f "/etc/init/$1.conf" ]; then
# Use upstart
case "$(status $1 2>/dev/null)" in
*running*)