Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-07 10:11:14 -06:00
parent a9b82f2506
commit bdd128af68

View File

@@ -21,41 +21,41 @@ STATUS() {
echo echo
echo -e "${idsCL[Yellow]} Node Service Status${idsCL[Default]}" echo -e "${idsCL[Yellow]} Node Service Status${idsCL[Default]}"
DIVIDER DIVIDER
if [ ! -z ${LOCAL_SERVICES+x} ]; then # if [ ! -z ${LOCAL_SERVICES+x} ]; then
lip=$(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) # 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]}" # echo -e "Node hostname: ${idsST[Bold]}${idsCL[LightCyan]}${NODE_HOSTNAME} (${lip})${idsST[Reset]}${idsCL[LightCyan]} - localhost${idsCL[Default]}"
DIVIDER false green # DIVIDER false green
for srvc in "${LOCAL_SERVICES[@]}" # for srvc in "${LOCAL_SERVICES[@]}"
do # do
if [[ "mysql,nginx,gitea,haproxy,keepalived,maxscale" = *"${srvc}"* ]]; then spc=" "; else spc=""; fi # if [[ "mysql,nginx,gitea,haproxy,keepalived,maxscale" = *"${srvc}"* ]]; then spc=" "; else spc=""; fi
echo -en "${NM_SERVICES[${srvc}]} $spc" # echo -en "${NM_SERVICES[${srvc}]} $spc"
if [ $(pgrep ${srvc} | wc -l) -gt "0" ]; then # if [ $(pgrep ${srvc} | wc -l) -gt "0" ]; then
echo -e "${idsCL[Green]}Running${idsCL[Default]}" # echo -e "${idsCL[Green]}Running${idsCL[Default]}"
else echo -e "${idsCL[Red]}Not Running${idsCL[Default]}" # else echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"
fi # fi
done # done
fi # fi
echo # echo
nid=1 # nid=1
for nip in "${NODE_HOSTS[@]}" # for nip in "${NODE_HOSTS[@]}"
do # do
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then NCMD=''; LH='- localhost' # 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='' # else NCMD="ssh root@${nip}"; LH=''
fi # fi
echo -e "Node hostname: ${idsST[Bold]}${idsCL[LightCyan]}iDS-Node${nid} (${nip})${idsST[Reset]}${idsCL[LightCyan]} ${LH}${idsCL[Default]}" # echo -e "Node hostname: ${idsST[Bold]}${idsCL[LightCyan]}iDS-Node${nid} (${nip})${idsST[Reset]}${idsCL[LightCyan]} ${LH}${idsCL[Default]}"
DIVIDER false green # DIVIDER false green
for srvc in "${NODE_SERVICES[@]}" # for srvc in "${NODE_SERVICES[@]}"
do # do
if [[ "mysql,nginx,gitea,haproxy,keepalived,maxscale" = *"${srvc}"* ]]; then spc=" "; else spc=""; fi # if [[ "mysql,nginx,gitea,haproxy,keepalived,maxscale" = *"${srvc}"* ]]; then spc=" "; else spc=""; fi
echo -en "${NM_SERVICES[${srvc}]} $spc" # echo -en "${NM_SERVICES[${srvc}]} $spc"
if [ $(${NCMD} pgrep ${srvc} | wc -l) -gt "0" ]; then # if [ $(${NCMD} pgrep ${srvc} | wc -l) -gt "0" ]; then
echo -e "${idsCL[Green]}Running${idsCL[Default]}" # echo -e "${idsCL[Green]}Running${idsCL[Default]}"
else echo -e "${idsCL[Red]}Not Running${idsCL[Default]}" # else echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"
fi # fi
done # done
echo # echo
nid=`expr $nid + 1` # nid=`expr $nid + 1`
done # done
echo echo
echo -e "${idsCL[Yellow]} Replication Status${idsCL[Default]}" echo -e "${idsCL[Yellow]} Replication Status${idsCL[Default]}"