mirror of
https://github.com/ovh/debian-cis.git
synced 2025-07-19 23:28:36 +02:00
update lib
This commit is contained in:
21
lib/utils.sh
21
lib/utils.sh
@@ -335,6 +335,27 @@ is_service_enabled() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_service_active() {
|
||||||
|
local SERVICE=$1
|
||||||
|
|
||||||
|
# if running in a container, it does not make much sense to test for systemd / service
|
||||||
|
# the var "IS_CONTAINER" defined in lib/constant may not be enough, in case we are using systemd slices
|
||||||
|
# currently, did not find a unified way to manage all cases, so we check this only for systemctl usage
|
||||||
|
is_using_sbin_init
|
||||||
|
if [ "$FNRET" -eq 1 ]; then
|
||||||
|
debug "host was not started using '/sbin/init', systemd should not be available"
|
||||||
|
FNRET=1
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if $SUDO_CMD systemctl -t service is-active "$SERVICE" >/dev/null; then
|
||||||
|
debug "Service $SERVICE is active"
|
||||||
|
FNRET=0
|
||||||
|
else
|
||||||
|
debug "Service $SERVICE is active"
|
||||||
|
FNRET=1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Kernel Options checks
|
# Kernel Options checks
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user