Update nodemgmt-scripts.sh
This commit is contained in:
@@ -18,6 +18,49 @@ source /opt/idssys/nodemgmt/defaults.inc
|
||||
|
||||
# ========================================================= #
|
||||
|
||||
STATUS() {
|
||||
echo -e "${idsCL[Yellow]} NodeMgmt - Galera/NGINX Node Management${idsCL[Default]} ${idsCL[DarkGray]}(ver-${VERS})${idsCL[Default]}"
|
||||
|
||||
if [ ! -z ${LOCAL_SERVICES+x} ]; then
|
||||
lip=$(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1)
|
||||
echo -e "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}"
|
||||
echo -e "Node hostname: ${idsST[Bold]}${idsCL[LightCyan]}${NODE_HOSTNAME} (${lip})${idsST[Reset]}${idsCL[LightCyan]} - localhost${idsCL[Default]}"
|
||||
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
|
||||
|
||||
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 "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}"
|
||||
echo -e "Node hostname: ${idsST[Bold]}${idsCL[LightCyan]}iDS-Node${nid} (${nip})${idsST[Reset]}${idsCL[LightCyan]} ${LH}${idsCL[Default]}"
|
||||
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
|
||||
nid=`expr $nid + 1`
|
||||
done
|
||||
|
||||
echo -e "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
||||
|
||||
@@ -253,46 +296,10 @@ case "$1" in
|
||||
;;
|
||||
|
||||
status)
|
||||
echo -e "${idsCL[Yellow]} NodeMgmt - Galera/NGINX Node Management${idsCL[Default]} ${idsCL[DarkGray]}(ver-${VERS})${idsCL[Default]}"
|
||||
STATUS
|
||||
if [ ${action-x} ]; then exit 0; fi
|
||||
read -n 1 -s -p "Press any key to continue"
|
||||
|
||||
if [ ! -z ${LOCAL_SERVICES+x} ]; then
|
||||
lip=$(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1)
|
||||
echo -e "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}"
|
||||
echo -e "Node hostname: ${idsST[Bold]}${idsCL[LightCyan]}${NODE_HOSTNAME} (${lip})${idsST[Reset]}${idsCL[LightCyan]} - localhost${idsCL[Default]}"
|
||||
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
|
||||
|
||||
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 "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}"
|
||||
echo -e "Node hostname: ${idsST[Bold]}${idsCL[LightCyan]}iDS-Node${nid} (${nip})${idsST[Reset]}${idsCL[LightCyan]} ${LH}${idsCL[Default]}"
|
||||
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
|
||||
nid=`expr $nid + 1`
|
||||
done
|
||||
|
||||
echo -e "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}"
|
||||
echo ""
|
||||
;;
|
||||
|
||||
status-check)
|
||||
|
||||
Reference in New Issue
Block a user