Skip to content

Commit

Permalink
service
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaredy899 authored Dec 24, 2024
1 parent 0e4759f commit 4eec1b1
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion 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,11 @@ enableService() {
rc-service)
"$ESCALATION_TOOL" rc-update add "$1"
;;
runit)
"$ESCALATION_TOOL" mkdir -p "/run/runit/supervise.$1"
"$ESCALATION_TOOL" ln -sf "/etc/sv/$1" "/var/service/"
sleep 2
;;
esac
}

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

Expand All @@ -68,6 +82,10 @@ startAndEnableService() {
enableService "$1"
startService "$1"
;;
runit)
enableService "$1"
startService "$1"
;;
esac
}

Expand All @@ -79,7 +97,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'

0 comments on commit 4eec1b1

Please sign in to comment.