File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -320,9 +320,8 @@ is_service_enabled() {
320320 # if running in a container, it does not make much sense to test for systemd / service
321321 # the var "IS_CONTAINER" defined in lib/constant may not be enough, in case we are using systemd slices
322322 # currently, did not find a unified way to manage all cases, so we check this only for systemctl usage
323- is_using_sbin_init
323+ is_systemctl_running
324324 if [ " $FNRET " -eq 1 ]; then
325- debug " host was not started using '/sbin/init', systemd should not be available"
326325 FNRET=1
327326 return
328327 fi
@@ -668,11 +667,10 @@ is_running_in_container() {
668667 awk -F/ ' $2 == "' " $1 " ' "' /proc/self/cgroup
669668}
670669
671- is_using_sbin_init () {
670+ is_systemctl_running () {
672671 FNRET=0
673- # remove '\0' to avoid 'command substitution: ignored null byte in input'
674- if [[ $( $SUDO_CMD cat /proc/1/cmdline | tr -d ' \0' ) != " /sbin/init" ]]; then
675- debug " init process is not '/sbin/init'"
672+ if ! systemctl > /dev/null 2>&1 ; then
673+ debug " systemctl is not running"
676674 FNRET=1
677675 fi
678676}
@@ -681,9 +679,8 @@ manage_service() {
681679 local action=" $1 "
682680 local service=" $2 "
683681
684- is_using_sbin_init
682+ is_systemctl_running
685683 if [ " $FNRET " -ne 0 ]; then
686- debug " /sbin/init not used, systemctl wont manage service $service "
687684 return
688685 fi
689686
You can’t perform that action at this time.
0 commit comments