Update nodemgmt-scripts.sh

This commit is contained in:
2023-03-19 11:27:30 -05:00
parent 0e41546946
commit 8058192c6b

View File

@@ -184,11 +184,9 @@ STATUS(){
else else
toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.down) toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.down)
fi fi
rm -f ${FOLDER}/${nip}.down; rm -f ${FOLDER}/${nip}.errtime rm -f ${FOLDER}/${nip}.down
#if [ "${EMAIL_NOTICE}" != "" ]; then echo "${NM_NODETYPES[$NTYPE]}-Node${nid} is back UP! It was down for $(SHOW_TIME ${toterrtime})\n$(date)" | mail -s "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}-UP" ${EMAIL_NOTICE}; fi rm -f ${FOLDER}/${nip}.errtime
SENDNOTICE "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}-UP" "${NM_NODETYPES[$NTYPE]}-Node${nid} is back UP! It was down for $(SHOW_TIME ${toterrtime})" SENDNOTICE "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}-UP" "${NM_NODETYPES[$NTYPE]}-Node${nid} is back UP! It was down for $(SHOW_TIME ${toterrtime})"
echo "$(date) - ${nip} - ${NM_NODETYPES[$NTYPE]}-Node${nid} - Node is back up, it was down for $(SHOW_TIME ${toterrtime})" >> ${LOGFILE}
fi fi
if [ "${ST_ACTION}" != "dockers" ]; then if [ "${ST_ACTION}" != "dockers" ]; then
@@ -423,8 +421,15 @@ STATUS(){
checkhost=$(CHECK_HOST ${nip}) checkhost=$(CHECK_HOST ${nip})
if [ "${checkhost}" != "false" ]; then if [ "${checkhost}" != "false" ]; then
if [ -f ${FOLDER}/${nip}.down ]; then if [ -f ${FOLDER}/${nip}.down ]; then
if [ -f ${FOLDER}/${nip}.errtime ]; then
toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.errtime)
else
toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.down)
fi
rm -f ${FOLDER}/${nip}.down rm -f ${FOLDER}/${nip}.down
# if [ "${EMAIL_NOTICE}" != "" ]; then echo "${NM_NODETYPES[$NTYPE]}-Node${nid} is back UP!" | mail -s "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}-UP" ${EMAIL_NOTICE}; fi rm -f ${FOLDER}/${nip}.errtime
SENDNOTICE "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}-UP" "${NM_NODETYPES[$NTYPE]}-Node${nid} is back UP! It was down for $(SHOW_TIME ${toterrtime})"
fi fi
var2=${NTYPE}_REPL_CHECK[@] var2=${NTYPE}_REPL_CHECK[@]
# timeout=`date --date='20 seconds' +%s` # timeout=`date --date='20 seconds' +%s`
@@ -652,7 +657,9 @@ CHECK_DOCKER_SERVICES(){
else else
toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.down) toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}.down)
fi fi
rm -f ${FOLDER}/${nip}.down; rm -f ${FOLDER}/${nip}.errtime rm -f ${FOLDER}/${nip}.down
rm -f ${FOLDER}/${nip}.errtime
SENDNOTICE "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}-UP" "${NM_NODETYPES[$NTYPE]}-Node${nid} is back UP! It was down for $(SHOW_TIME ${toterrtime})"
fi fi
for docker in "${!dockers}"; do for docker in "${!dockers}"; do