replace runit with sv

sv works with runit, and we don't need to sleep command.
This commit is contained in:
Jaredy899 2025-01-20 20:18:26 -05:00 committed by GitHub
parent 9c71edf061
commit 2b27fa217b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,7 +23,7 @@ startService() {
rc-service) rc-service)
"$ESCALATION_TOOL" "$INIT_MANAGER" "$1" start "$ESCALATION_TOOL" "$INIT_MANAGER" "$1" start
;; ;;
runit) sv)
"$ESCALATION_TOOL" sv start "$1" "$ESCALATION_TOOL" sv start "$1"
;; ;;
esac esac
@ -37,7 +37,7 @@ stopService() {
rc-service) rc-service)
"$ESCALATION_TOOL" "$INIT_MANAGER" "$1" stop "$ESCALATION_TOOL" "$INIT_MANAGER" "$1" stop
;; ;;
runit) sv)
"$ESCALATION_TOOL" sv stop "$1" "$ESCALATION_TOOL" sv stop "$1"
;; ;;
esac esac
@ -51,10 +51,8 @@ enableService() {
rc-service) rc-service)
"$ESCALATION_TOOL" rc-update add "$1" "$ESCALATION_TOOL" rc-update add "$1"
;; ;;
runit) sv)
"$ESCALATION_TOOL" ln -sf "/etc/sv/$1" "/var/service/" "$ESCALATION_TOOL" ln -sf "/etc/sv/$1" "/var/service/"
printf "%b\n" "${YELLOW}Waiting 5 seconds...${RC}"
sleep 5
;; ;;
esac esac
} }
@ -67,7 +65,7 @@ disableService() {
rc-service) rc-service)
"$ESCALATION_TOOL" rc-update del "$1" "$ESCALATION_TOOL" rc-update del "$1"
;; ;;
runit) sv)
"$ESCALATION_TOOL" rm -f "/var/service/$1" "$ESCALATION_TOOL" rm -f "/var/service/$1"
;; ;;
esac esac
@ -78,7 +76,7 @@ startAndEnableService() {
systemctl) systemctl)
"$ESCALATION_TOOL" "$INIT_MANAGER" enable --now "$1" "$ESCALATION_TOOL" "$INIT_MANAGER" enable --now "$1"
;; ;;
rc-service | runit) rc-service | sv)
enableService "$1" enableService "$1"
startService "$1" startService "$1"
;; ;;
@ -93,10 +91,10 @@ isServiceActive() {
rc-service) rc-service)
"$ESCALATION_TOOL" "$INIT_MANAGER" "$1" status --quiet "$ESCALATION_TOOL" "$INIT_MANAGER" "$1" status --quiet
;; ;;
runit) sv)
"$ESCALATION_TOOL" sv status "$1" >/dev/null 2>&1 "$ESCALATION_TOOL" sv status "$1" >/dev/null 2>&1
;; ;;
esac esac
} }
checkInitManager 'systemctl rc-service runit' checkInitManager 'systemctl rc-service sv'