This commit is contained in:
2019-01-29 09:05:13 -06:00
parent f7fdedd72c
commit f8a66c1c8d
2 changed files with 22 additions and 32 deletions

View File

@@ -130,6 +130,7 @@ case "$1" in
if [ "${srvc}" = "mysql" ]; then SER='MySQL: '
elif [ "${srvc}" = "nginx" ]; then SER='NGINX: '
elif [ "${srvc}" = "gogs" ]; then SER='Gogs: '
elif [ "${srvc}" = "gitea" ]; then SER='Gitea: '
elif [ "${srvc}" = "haproxy" ]; then SER='HAProxy:'
elif [ "${srvc}" = "keepalived" ]; then SER='Keepalived:'
elif [ "${srvc}" = "maxscale" ]; then SER='MaxScale:'

53
run.sh
View File

@@ -5,44 +5,33 @@ source /opt/idssys/nodemgmt/settings.conf
source /opt/idssys/defaults/colors.inc
# source /opt/idssys/defaults/default.inc
VERS=`mysql -h 10.5.10.56 -P 3308 -u sqluser -pdcs2057 -s -N -e "SELECT value FROM idssys.nodemgmt WHERE var = 'VERS'"`
NODE_SERVICES=mysql,nginx,gitea,haproxy,keepalived,maxscale
IFS=,
NODE_SERVICES=(${NODE_SERVICES})
unset IFS
if [ "$1" != "service" ] && [ "$1" != "status" ] && [ "$1" != "" ]; then
if [ $(pgrep mysql | wc -l) -gt "0" ]; then
SER_MYSQL="${idsCL[Green]}Running${idsCL[Default]}"
else SER_MYSQL="${idsCL[Red]}Not Running${idsCL[Default]}"
fi
if [ $(pgrep haproxy | wc -l) -gt "0" ]; then
SER_HAP="${idsCL[Green]}Running${idsCL[Default]}"
else SER_HAP="${idsCL[Red]}Not Running${idsCL[Default]}"
fi
if [ $(pgrep nginx | wc -l) -gt "0" ]; then
SER_NGINX="${idsCL[Green]}Running${idsCL[Default]}"
else SER_NGINX="${idsCL[Red]}Not Running${idsCL[Default]}"
fi
if [ $(pgrep keepalived | wc -l) -gt "0" ]; then
SER_KA="${idsCL[Green]}Running${idsCL[Default]}"
else SER_KA="${idsCL[Red]}Not Running${idsCL[Default]}"
fi
if [ $(pgrep gogs | wc -l) -gt "0" ]; then
SER_GOGS="${idsCL[Green]}Running${idsCL[Default]}"
else SER_GOGS="${idsCL[Red]}Not Running${idsCL[Default]}"
fi
if [ $(pgrep maxscale | wc -l) -gt "0" ]; then
SER_MS="${idsCL[Green]}Running${idsCL[Default]}"
else SER_MS="${idsCL[Red]}Not Running${idsCL[Default]}"
fi
echo ""
echo -e "${idsCL[Yellow]} NodeMgmt - Galera/NGINX Node Management${idsCL[Default]} ${idsCL[DarkGray]}(ver-${VERS})${idsCL[Default]}"
echo -e "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}"
echo -e "Node hostname: ${node_hostname}"
echo -e "MySQL: ${SER_MYSQL}"
echo -e "NGINX: ${SER_NGINX}"
echo -e "Gogs: ${SER_GOGS}"
echo -e "HAProxy: ${SER_HAP}"
echo -e "Keepalived: ${SER_KA}"
echo -e "MaxScale: ${SER_MS}"
for srvc in "${NODE_SERVICES[@]}"
do
if [ "${srvc}" = "mysql" ]; then SER='MySQL: '
elif [ "${srvc}" = "nginx" ]; then SER='NGINX: '
elif [ "${srvc}" = "gogs" ]; then SER='Gogs: '
elif [ "${srvc}" = "gitea" ]; then SER='Gitea: '
elif [ "${srvc}" = "haproxy" ]; then SER='HAProxy:'
elif [ "${srvc}" = "keepalived" ]; then SER='Keepalived:'
elif [ "${srvc}" = "maxscale" ]; then SER='MaxScale:'
else SER="${2}"
fi
echo -en "${SER} "
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 -e "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}"
echo ""