summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xservicectl19
1 files changed, 18 insertions, 1 deletions
diff --git a/servicectl b/servicectl
index d8201ec..1cc3e6f 100755
--- a/servicectl
+++ b/servicectl
@@ -20,10 +20,15 @@ reverse_array () {
## FIND INIT
INIT="$(readlink $(type init) )"
+if `type s6-rc >/dev/null`; then
+ S6=y
+else
+ unset S6
+fi
if [ "$INIT" = "openrc-init" ]; then
OPENRC=y
- unset RUNIT S6 DINIT
+ unset RUNIT DINIT
fi
## CHECK PRIVS
@@ -35,24 +40,36 @@ fi
## SERVICE FUNCTIONS
start_service () {
+ if [ -n "$S6" ]; then
+ $ROOTCMD s6-rc -u change $1
+ fi
if [ -n "$OPENRC" ]; then
$ROOTCMD rc-service $1 start
fi
}
stop_service () {
+ if [ -n "$S6" ]; then
+ $ROOTCMD s6-rc -d change $1
+ fi
if [ -n "$OPENRC" ]; then
$ROOTCMD rc-service $1 stop
fi
}
enable_service () {
+ if [ -n "$S6" ]; then
+ $ROOTCMD s6-service add default $1
+ fi
if [ -n "$OPENRC" ]; then
$ROOTCMD rc-update add $1 default
fi
}
disable_service () {
+ if [ -n "$S6" ]; then
+ $ROOTCMD s6-service delete default $1
+ fi
if [ -n "$OPENRC" ]; then
$ROOTCMD rc-update del $1 default
fi