Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-07 21:23:11 -06:00
parent 8d8eff747b
commit 7494cd89d3

View File

@@ -63,7 +63,7 @@ STATUS() {
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
f [ "$(systemctl is-active ${srvc})" = "active" ]; then
echo -e "${idsCL[Green]}Running${idsCL[Default]}"
rm -f ${FOLDER}/localhost-${srvc}.down
else
@@ -91,7 +91,7 @@ STATUS() {
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
echo "${NCMD}"
echo -en " ${NM_SERVICES[${srvc}]}$spc: "
if [ $(${NCMD} pgrep ${srvc} | wc -l) -gt "0" ]; then
if [ "$(${NCMD} systemctl is-active ${srvc})" = "active" ]; then
echo -e "${idsCL[Green]}Running${idsCL[Default]}"
rm -f ${FOLDER}/${nip}-${srvc}.down
else
@@ -185,9 +185,8 @@ STATUS-CHECK(){
done
if [ ! -z ${LOCAL_SERVICES+x} ]; then
lip=$(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1)
for srvc in "${LOCAL_SERVICES[@]}"
do
if [ $(pgrep ${srvc} | wc -l) -lt "1" ]; then
for srvc in "${LOCAL_SERVICES[@]}"; do
if [ "$(systemctl is-active ${srvc})" != "active" ]; then
echo "${NM_SERVICES[${srvc}]} is down" | mail -s "${NODE_HOSTNAME}-${nip}" ${STATUS_CHECK_EMAIL}
touch ${FOLDER}/localhost-${srvc}.down
elif [ -f ${FOLDER}/localhost-${srvc}.down ]; then
@@ -208,9 +207,8 @@ STATUS-CHECK(){
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then NCMD=''
else NCMD="ssh root@${nip}"
fi
for srvc in "${NODE_SERVICES[@]}"
do
if [ $(${NCMD} pgrep ${srvc} | wc -l) -lt "1" ]; then
for srvc in "${NODE_SERVICES[@]}"; do
if [ "$(${NCMD} systemctl is-active ${srvc})" != "active" ]; then
echo "${NM_SERVICES[${srvc}]} is down" | mail -s "iDS-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL}
touch ${FOLDER}/${nip}-${srvc}.down
elif [ -f ${FOLDER}/${nip}-${srvc}.down ]; then