diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index f0ce594f..13dc45d7 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -32,41 +32,41 @@ STATUS() { echo echo -e "${idsCL[Yellow]} Node Service Status${idsCL[Default]}" DIVIDER - # if [ ! -z ${LOCAL_SERVICES+x} ]; then - # lip=$(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) - # echo -e "Node hostname: ${idsST[Bold]}${idsCL[LightCyan]}${NODE_HOSTNAME} (${lip})${idsST[Reset]}${idsCL[LightCyan]} - localhost${idsCL[Default]}" - # DIVIDER false green - # for srvc in "${LOCAL_SERVICES[@]}" - # do - # if [[ "mysql,nginx,gitea,haproxy,keepalived,maxscale" = *"${srvc}"* ]]; then spc=" "; else spc=""; fi - # 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 - # fi - # echo - # 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 "Node hostname: ${idsST[Bold]}${idsCL[LightCyan]}iDS-Node${nid} (${nip})${idsST[Reset]}${idsCL[LightCyan]} ${LH}${idsCL[Default]}" - # DIVIDER false green - # for srvc in "${NODE_SERVICES[@]}" - # do - # if [[ "mysql,nginx,gitea,haproxy,keepalived,maxscale" = *"${srvc}"* ]]; then spc=" "; else spc=""; fi - # 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 + if [ ! -z ${LOCAL_SERVICES+x} ]; then + lip=$(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) + echo -e "Node hostname: ${idsST[Bold]}${idsCL[LightCyan]}${NODE_HOSTNAME} (${lip})${idsST[Reset]}${idsCL[LightCyan]} - localhost${idsCL[Default]}" + DIVIDER false green + for srvc in "${LOCAL_SERVICES[@]}" + do + if [[ "mysql,nginx,gitea,haproxy,keepalived,maxscale" = *"${srvc}"* ]]; then spc=" "; else spc=""; fi + 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 + fi + echo + 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 "Node hostname: ${idsST[Bold]}${idsCL[LightCyan]}iDS-Node${nid} (${nip})${idsST[Reset]}${idsCL[LightCyan]} ${LH}${idsCL[Default]}" + DIVIDER false green + for srvc in "${NODE_SERVICES[@]}" + do + if [[ "mysql,nginx,gitea,haproxy,keepalived,maxscale" = *"${srvc}"* ]]; then spc=" "; else spc=""; fi + 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 echo -e "${idsCL[Yellow]} Replication Status${idsCL[Default]}" DIVIDER true @@ -75,7 +75,7 @@ STATUS() { for nip in "${NODE_HOSTS[@]}" do if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]]; then - echo -e "Node hostname : ${idsST[Bold]}${idsCL[LightCyan]}iDS-Node${nid} (${nip})${idsST[Reset]}${idsCL[Default]}" + echo -e " ${idsST[Bold]}${idsCL[LightCyan]}iDS-Node${nid} (${nip})${idsST[Reset]}${idsCL[Default]}" DIVIDER false green for rcheck in "${REPL_CHECK[@]}" do