mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-16 09:40:21 +00:00
Add debian based distro specific SysV init check
This commit is contained in:
parent
800657e965
commit
6788c02dcf
1 changed files with 38 additions and 1 deletions
|
@ -1339,6 +1339,32 @@ __check_services_sysvinit() {
|
|||
} # ---------- end of function __check_services_sysvinit ----------
|
||||
|
||||
|
||||
#--- FUNCTION -------------------------------------------------------------------------------------------------------
|
||||
# NAME: __check_services_debian
|
||||
# DESCRIPTION: Return 0 or 1 in case the service is enabled or not
|
||||
# PARAMETERS: servicename
|
||||
#----------------------------------------------------------------------------------------------------------------------
|
||||
__check_services_debian() {
|
||||
if [ $# -eq 0 ]; then
|
||||
echoerror "You need to pass a service name to check!"
|
||||
exit 1
|
||||
elif [ $# -ne 1 ]; then
|
||||
echoerror "You need to pass a service name to check as the single argument to the function"
|
||||
fi
|
||||
|
||||
servicename=$1
|
||||
echodebug "Checking if service ${servicename} is enabled"
|
||||
|
||||
if [ "$(service --status-all 2>1 | grep ${servicename} | grep '\[ + \]')" != "" ]; then
|
||||
echodebug "Service ${servicename} is enabled"
|
||||
return 0
|
||||
else
|
||||
echodebug "Service ${servicename} is NOT enabled"
|
||||
return 1
|
||||
fi
|
||||
} # ---------- end of function __check_services_debian ----------
|
||||
|
||||
|
||||
#######################################################################################################################
|
||||
#
|
||||
# Distribution install functions
|
||||
|
@ -1636,7 +1662,7 @@ install_ubuntu_check_services() {
|
|||
if [ -f /sbin/initctl ] && [ -f /etc/init/salt-$fname ]; then
|
||||
__check_services_upstart salt-$fname || return 1
|
||||
elif [ -f /etc/init.d/salt-$fname ]; then
|
||||
__check_services_sysvinit salt-$fname || return 1
|
||||
__check_services_debian salt-$fname || return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
|
@ -1999,6 +2025,17 @@ install_debian_restart_daemons() {
|
|||
/etc/init.d/salt-$fname start
|
||||
done
|
||||
}
|
||||
|
||||
install_debian_check_services() {
|
||||
for fname in minion master syndic; do
|
||||
# Skip if not meant to be installed
|
||||
[ $fname = "minion" ] && [ $_INSTALL_MINION -eq $BS_FALSE ] && continue
|
||||
[ $fname = "master" ] && [ $_INSTALL_MASTER -eq $BS_FALSE ] && continue
|
||||
[ $fname = "syndic" ] && [ $_INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
||||
__check_services_debian salt-$fname || return 1
|
||||
done
|
||||
return 0
|
||||
}
|
||||
#
|
||||
# Ended Debian Install Functions
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue