Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-03 22:17:31 -06:00
parent ce80c7c3aa
commit e9a918f103

View File

@@ -363,22 +363,22 @@ SET-PERMISSIONS(){
}
SERVICE(){
if [ "${NM_SERVICES[${2}]}" = "" ]; then
echo -e "${idsCL[Red]}(${2}) is not an allowed service.${idsCL[Default]}"
if [ "${NM_SERVICES[${1}]}" = "" ]; then
echo -e "${idsCL[Red]}(${1}) is not an allowed service.${idsCL[Default]}"
exit 1
fi
if [[ "start,stop,restart,reload,enable,disable" != *"${3}"* ]] && [ "${2}" != "daemon-reload" ]; then
if [[ "start,stop,restart,reload,enable,disable" != *"${2}"* ]] && [ "${1}" != "daemon-reload" ]; then
echo -e "${idsCL[Red]}(${3}) is not an allowed service action.${idsCL[Default]}"
exit 1
fi
if [ "$3" = "stop" ]; then ADISP='Stopp'
elif [ "$3" = "enable" ]; then ADISP='Enabl'
elif [ "$3" = "disable" ]; then ADISP='Disabl'
else ADISP=${3~}
if [ "$2" = "stop" ]; then ADISP='Stopp'
elif [ "$2" = "enable" ]; then ADISP='Enabl'
elif [ "$2" = "disable" ]; then ADISP='Disabl'
else ADISP=${2~}
fi
if [ "$3" = "start" ] && [ "$2" = "haproxy" ]; then TACT='restart'; else TACT="${3}"; fi
if [ "$2" = "start" ] && [ "$1" = "haproxy" ]; then TACT='restart'; else TACT="${2}"; fi
echo -e "${idsCL[LightGreen]}[[${NM_SERVICES[${2}]} ${ADISP}ing]]${idsCL[Default]}"
echo -e "${idsCL[LightGreen]}[[${NM_SERVICES[${1}]} ${ADISP}ing]]${idsCL[Default]}"
echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}"
nid=1
@@ -391,19 +391,19 @@ SERVICE(){
NCMD="ssh root@${nip}"
fi
echo -en "${ADISP}ing on iDS-Node${nid} ($nip)... ${idsCL[Default]}"
$NCMD systemctl $3 $2
if [[ "enable,disable" = *"${3}"* ]] || [ "${2}" = "daemon-reload" ]; then
$NCMD systemctl $2 $1
if [[ "enable,disable" = *"${2}"* ]] || [ "${1}" = "daemon-reload" ]; then
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
elif [[ $(${NCMD} pgrep ${2} | wc -l) -gt "0" ]]; then
elif [[ $(${NCMD} pgrep ${1} | wc -l) -gt "0" ]]; then
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
elif [ "$3" = "stop" ]; then echo -e "${idsCL[Red]}STOPPED${idsCL[Default]}"
elif [ "$2" = "stop" ]; then echo -e "${idsCL[Red]}STOPPED${idsCL[Default]}"
else echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
fi
nid=`expr $nid + 1`
done
echo ""
echo -e "${idsCL[Green]}${NM_SERVICES[${2}]} has been ${ADISP}ed${idsCL[Default]}"
echo -e "${idsCL[Green]}${NM_SERVICES[${1}]} has been ${ADISP}ed${idsCL[Default]}"
echo ""
}