diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index b542f202..f97b5772 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -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 > /dev/null 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 @@ -1417,7 +1417,7 @@ SERVICE(){ fi checkhost=$(CHECK_HOST ${nip}) if [ "${checkhost}" != "false" ]; then - #$NCMD mount -a + $NCMD mount -a > /dev/null 2>&1 if [ "${3}" != "q" ]; then if [[ "${NCHOSTS}" == *"${nip}"* ]]; then mntpath="/mnt/Nextcloud-Data" @@ -1426,9 +1426,9 @@ SERVICE(){ fi ${NCMD} "test -e ${mntpath}/mounted" if [ $? -eq 0 ]; then - echo -e "${idsCL[Green]}MOUNTED${idsCL[Default]}" + echo -e "${idsCL[Green]}MOUNTED ($mntpath)${idsCL[Default]}" else - echo -e "${idsCL[Red]}NOT MOUNTED${idsCL[Default]}" + echo -e "${idsCL[Red]}NOT MOUNTED ($mntpath)${idsCL[Default]}" fi fi elif [ "${3}" != "q" ]; then @@ -1444,7 +1444,7 @@ SERVICE(){ for NTYPE in "${NODE_TYPES[@]}"; do var=${NTYPE}_HOSTS[@] for nip in "${!var}"; do - if [[ IP == *"${nip}"* ]]; then + if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then NODE_TYPE=${NTYPE}; break 2 fi