From 1eec518be72076ab5667753bc687e37e4470ba8f Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 20 Feb 2014 10:57:04 +0000 Subject: [PATCH] Add a general systemd services enabled check function --- bootstrap-salt.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d0e9d3e..32ce2fc 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1253,6 +1253,23 @@ movefile() { return 0 } + + +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __check_services_systemd +# DESCRIPTION: Return 0 or 1 in case the service is enabled or not +# PARAMETERS: servicename +#---------------------------------------------------------------------------------------------------------------------- +__check_services_systemd() { + servicename=$? + if [ $(systemctl is-enabled ${servicename}) = "enabled" ]; then + return 0 + else + return 1 + fi +} # ---------- end of function __check_services_systemd ---------- + + ####################################################################################################################### # # Distribution install functions