Update nodemgmt-scripts.sh

This commit is contained in:
2022-10-14 23:02:15 -05:00
parent 145eaefa27
commit 745c9d5550

View File

@@ -1368,36 +1368,36 @@ SERVICE(){
if [ "$1" = "glusterd" ]; then
for nip in "${GL_HOSTS[@]}"; do
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
nip='localhost '
NCMD=''
else
NCMD="ssh root@${nip}"
fi
if [ "${3}" != "q" ]; then
echo -en "${NM_SRVCOPTS[${2}]}ing on '$nip'... ${idsCL[Default]}"
fi
checkhost=$(CHECK_HOST ${nip})
if [ "${checkhost}" != "false" ]; then
#$NCMD systemctl $2 $1
if [ "${3}" = "q" ]; then
if [[ "enable,disable" = *"${2}"* ]] || [ "${1}" = "daemon-reload" ]; then
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
elif [ "$(${NCMD} systemctl is-active ${1})" = "active" ]; then
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
elif [ "$2" = "stop" ]; then
echo -e "${idsCL[Red]}STOPPED${idsCL[Default]}"
else
echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
fi
fi
elif [ "${3}" != "q" ]; then
echo -e "${idsCL[Red]}Node is Down${idsCL[Default]}"
fi
done
# for nip in "${GL_HOSTS[@]}"; do
# if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
# nip='localhost '
# NCMD=''
# else
# NCMD="ssh root@${nip}"
# fi
#
# if [ "${3}" != "q" ]; then
# echo -en "${NM_SRVCOPTS[${2}]}ing on '$nip'... ${idsCL[Default]}"
# fi
# checkhost=$(CHECK_HOST ${nip})
# if [ "${checkhost}" != "false" ]; then
# #$NCMD systemctl $2 $1
# if [ "${3}" != "q" ]; then
# if [[ "enable,disable" = *"${2}"* ]] || [ "${1}" = "daemon-reload" ]; then
# echo -e "${idsCL[Green]}OK${idsCL[Default]}"
# elif [ "$(${NCMD} systemctl is-active ${1})" = "active" ]; then
# echo -e "${idsCL[Green]}OK${idsCL[Default]}"
# elif [ "$2" = "stop" ]; then
# echo -e "${idsCL[Red]}STOPPED${idsCL[Default]}"
# else
# echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
# fi
# fi
# elif [ "${3}" != "q" ]; then
# echo -e "${idsCL[Red]}Node is Down${idsCL[Default]}"
# fi
#
# done
if [ "${2}" = "start" ] || [ "${2}" = "restart" ]; then