Skip to content
Merged
20 changes: 18 additions & 2 deletions core/tabs/common-service-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ startService() {
rc-service)
"$ESCALATION_TOOL" "$INIT_MANAGER" "$1" start
;;
runit)
"$ESCALATION_TOOL" sv start "$1"
;;
esac
}

Expand All @@ -34,6 +37,9 @@ stopService() {
rc-service)
"$ESCALATION_TOOL" "$INIT_MANAGER" "$1" stop
;;
runit)
"$ESCALATION_TOOL" sv stop "$1"
;;
esac
}

Expand All @@ -45,6 +51,10 @@ enableService() {
rc-service)
"$ESCALATION_TOOL" rc-update add "$1"
;;
runit)
"$ESCALATION_TOOL" ln -sf "/etc/sv/$1" "/var/service/"
sleep 5
;;
esac
}

Expand All @@ -56,6 +66,9 @@ disableService() {
rc-service)
"$ESCALATION_TOOL" rc-update del "$1"
;;
runit)
"$ESCALATION_TOOL" rm -f "/var/service/$1"
;;
esac
}

Expand All @@ -64,7 +77,7 @@ startAndEnableService() {
systemctl)
"$ESCALATION_TOOL" "$INIT_MANAGER" enable --now "$1"
;;
rc-service)
rc-service|runit)
enableService "$1"
startService "$1"
;;
Expand All @@ -79,7 +92,10 @@ isServiceActive() {
rc-service)
"$ESCALATION_TOOL" "$INIT_MANAGER" "$1" status --quiet
;;
runit)
"$ESCALATION_TOOL" sv status "$1" >/dev/null 2>&1
;;
esac
}

checkInitManager 'systemctl rc-service'
checkInitManager 'systemctl rc-service runit'
Loading