From e6312b34689b53141167839df15f5c0ef9f195ce Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Thu, 7 Feb 2019 12:20:48 -0600 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 84 ++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index b121f6db..74f46ecb 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -37,48 +37,48 @@ STATUS() { fi done - # echo -e "${idsST[Bold]}"; DIVIDER - # echo -e "${idsCL[Yellow]} Node Service Status${idsCL[Default]}" - # DIVIDER; echo -e "${idsST[Reset]}" - # if [ ! -z ${LOCAL_SERVICES+x} ]; then - # lip=$(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) - # echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${NODE_HOSTNAME} (${lip})${idsST[Reset]}${idsCL[LightCyan]} - localhost${idsCL[Default]}" - # DIVIDER false green - # for srvc in "${LOCAL_SERVICES[@]}" - # do - # c=0; cw=22; spc='' - # spc1=${cw}-${#NM_SERVICES[${srvc}]} - # until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done - # echo -en " ${NM_SERVICES[${srvc}]}$spc: " - # if [ $(pgrep ${srvc} | wc -l) -gt "0" ]; then - # echo -e "${idsCL[Green]}Running${idsCL[Default]}" - # else echo -e "${idsCL[Red]}Not Running${idsCL[Default]}" - # fi - # done - # echo - # fi - # nid=1 - # for nip in "${NODE_HOSTS[@]}" - # do - # if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then NCMD=''; LH='- localhost' - # else NCMD="ssh root@${nip}"; LH='' - # fi - # echo -e " ${idsST[Bold]}${idsCL[LightCyan]}iDS-Node${nid} (${nip})${idsST[Reset]}${idsCL[LightCyan]} ${LH}${idsCL[Default]}" - # DIVIDER false green - # for srvc in "${NODE_SERVICES[@]}" - # do - # c=0; cw=22; spc='' - # spc1=${cw}-${#NM_SERVICES[${srvc}]} - # until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done - # echo -en " ${NM_SERVICES[${srvc}]}$spc: " - # if [ $(${NCMD} pgrep ${srvc} | wc -l) -gt "0" ]; then - # echo -e "${idsCL[Green]}Running${idsCL[Default]}" - # else echo -e "${idsCL[Red]}Not Running${idsCL[Default]}" - # fi - # done - # echo - # nid=`expr $nid + 1` - # done + echo -e "${idsST[Bold]}"; DIVIDER + echo -e "${idsCL[Yellow]} Node Service Status${idsCL[Default]}" + DIVIDER; echo -e "${idsST[Reset]}" + if [ ! -z ${LOCAL_SERVICES+x} ]; then + lip=$(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) + echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${NODE_HOSTNAME} (${lip})${idsST[Reset]}${idsCL[LightCyan]} - localhost${idsCL[Default]}" + DIVIDER false green + for srvc in "${LOCAL_SERVICES[@]}" + do + c=0; cw=22; spc='' + spc1=${cw}-${#NM_SERVICES[${srvc}]} + until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done + echo -en " ${NM_SERVICES[${srvc}]}$spc: " + if [ $(pgrep ${srvc} | wc -l) -gt "0" ]; then + echo -e "${idsCL[Green]}Running${idsCL[Default]}" + else echo -e "${idsCL[Red]}Not Running${idsCL[Default]}" + fi + done + echo + fi + nid=1 + for nip in "${NODE_HOSTS[@]}" + do + if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then NCMD=''; LH='- localhost' + else NCMD="ssh root@${nip}"; LH='' + fi + echo -e " ${idsST[Bold]}${idsCL[LightCyan]}iDS-Node${nid} (${nip})${idsST[Reset]}${idsCL[LightCyan]} ${LH}${idsCL[Default]}" + DIVIDER false green + for srvc in "${NODE_SERVICES[@]}" + do + c=0; cw=22; spc='' + spc1=${cw}-${#NM_SERVICES[${srvc}]} + until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done + echo -en " ${NM_SERVICES[${srvc}]}$spc: " + if [ $(${NCMD} pgrep ${srvc} | wc -l) -gt "0" ]; then + echo -e "${idsCL[Green]}Running${idsCL[Default]}" + else echo -e "${idsCL[Red]}Not Running${idsCL[Default]}" + fi + done + echo + nid=`expr $nid + 1` + done echo -e "${idsST[Bold]}"; DIVIDER echo -e "${idsCL[Yellow]} Replication Status to Other Nodes${idsCL[Default]}" DIVIDER; echo -e "${idsST[Reset]}"