Update status.inc
This commit is contained in:
@@ -72,10 +72,10 @@ STATUS(){
|
||||
else
|
||||
errtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${NODE_HOSTNAME}.${srvc}.down)
|
||||
if [ $errtime -gt ${RENOTIFY} ]; then
|
||||
if [ ! -f ${TMPFOLDER}/${NODE_HOSTNAME}-${srvc}.errtime ]; then
|
||||
mv ${TMPFOLDER}/${NODE_HOSTNAME}.${srvc}.down ${TMPFOLDER}/${NODE_HOSTNAME}-${srvc}.errtime
|
||||
if [ ! -f ${TMPFOLDER}/${NODE_HOSTNAME}.${srvc}.errtime ]; then
|
||||
mv ${TMPFOLDER}/${NODE_HOSTNAME}.${srvc}.down ${TMPFOLDER}/${NODE_HOSTNAME}.${srvc}.errtime
|
||||
fi
|
||||
toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${NODE_HOSTNAME}-${srvc}.errtime)
|
||||
toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${NODE_HOSTNAME}.${srvc}.errtime)
|
||||
if [ "${ST_ACTION}" != "check" ]; then
|
||||
echo -e "${idsCL[Red]}Not running for $(SHOW_TIME ${toterrtime})${idsCL[Default]}"
|
||||
fi
|
||||
@@ -87,12 +87,12 @@ STATUS(){
|
||||
echo -e "${idsCL[Green]}Running${idsCL[Default]}"
|
||||
fi
|
||||
if [ -f ${TMPFOLDER}/${NODE_HOSTNAME}.${srvc}.down ]; then
|
||||
if [ -f ${TMPFOLDER}/${NODE_HOSTNAME}-${srvc}.errtime ]; then
|
||||
toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${NODE_HOSTNAME}-${srvc}.errtime)
|
||||
if [ -f ${TMPFOLDER}/${NODE_HOSTNAME}.${srvc}.errtime ]; then
|
||||
toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${NODE_HOSTNAME}.${srvc}.errtime)
|
||||
else
|
||||
toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${NODE_HOSTNAME}.${srvc}.down)
|
||||
fi
|
||||
rm -f ${TMPFOLDER}/${NODE_HOSTNAME}-${srvc}.*
|
||||
rm -f ${TMPFOLDER}/${NODE_HOSTNAME}.${srvc}.*
|
||||
SENDNOTICE "${NODE_HOSTNAME}" "${NM_SERVICES[${srvc}]} is back UP! It was down for $(SHOW_TIME ${toterrtime})"
|
||||
echo "$(date) - LOCAL - ${NODE_HOSTNAME} - ${NM_SERVICES[${srvc}]} is back up" >> ${LOGFILE}
|
||||
|
||||
@@ -193,8 +193,8 @@ STATUS(){
|
||||
else
|
||||
errtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}.${srvc}.down)
|
||||
if [ $errtime -gt ${RENOTIFY} ]; then
|
||||
[ ! -f ${TMPFOLDER}/${nip}-${srvc}.errtime ] && mv ${TMPFOLDER}/${nip}.${srvc}.down ${TMPFOLDER}/${nip}-${srvc}.errtime
|
||||
toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}-${srvc}.errtime)
|
||||
[ ! -f ${TMPFOLDER}/${nip}.${srvc}.errtime ] && mv ${TMPFOLDER}/${nip}.${srvc}.down ${TMPFOLDER}/${nip}.${srvc}.errtime
|
||||
toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}.${srvc}.errtime)
|
||||
touch ${TMPFOLDER}/${nip}.${srvc}.down
|
||||
SENDNOTICE "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}" "${NM_SERVICES[${srvc}]} is down" 1
|
||||
# ([ "${srvc}" == "mysql" ] || [ "${srvc}" == "mariadb" ]) && ${NCMD} systemctl restart ${srvc} &
|
||||
@@ -208,16 +208,16 @@ STATUS(){
|
||||
else
|
||||
[ "${ST_ACTION}" != "check" ] && echo -e "${idsCL[Green]}Running${idsCL[Default]}"
|
||||
if [ -f ${TMPFOLDER}/${nip}.${srvc}.down ]; then
|
||||
[ -f ${TMPFOLDER}/${nip}-${srvc}.errtime ] && toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}-${srvc}.errtime) || toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}.${srvc}.down)
|
||||
[ -f ${TMPFOLDER}/${nip}.${srvc}.errtime ] && toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}.${srvc}.errtime) || toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}.${srvc}.down)
|
||||
SENDNOTICE "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}" "${NM_SERVICES[${srvc}]} is back UP! It was down for $(SHOW_TIME ${toterrtime})"
|
||||
echo "$(date) - ${nip} - ${NM_NODETYPES[$NTYPE]}-Node${nid} - ${NM_SERVICES[${srvc}]} is back up, it was down for $(SHOW_TIME ${toterrtime})" >> ${LOGFILE}
|
||||
|
||||
rm -f ${TMPFOLDER}/${nip}-${srvc}.*
|
||||
rm -f ${TMPFOLDER}/${nip}.${srvc}.*
|
||||
|
||||
fi
|
||||
# if [ "${srvc}" == "pdnsadmin.socket" ] || [ "${srvc}" == "pdnsadmin" ] || [ "${srvc}" == "gitea" ]; then
|
||||
if [ "${srvc}" == "gitea" ]; then
|
||||
rm -f ${FOLDER}/*-${srvc}.*
|
||||
rm -f ${FOLDER}/*.${srvc}.*
|
||||
fi
|
||||
fi
|
||||
[ "${mysqlgo}" = "true" ] && unset mysqlgo
|
||||
@@ -266,10 +266,10 @@ STATUS(){
|
||||
# else
|
||||
# errtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}.${srvc}.down)
|
||||
# if [ $errtime -gt ${RENOTIFY} ]; then
|
||||
# if [ ! -f ${TMPFOLDER}/${nip}-${srvc}.errtime ]; then
|
||||
# mv ${TMPFOLDER}/${nip}.${srvc}.down ${TMPFOLDER}/${nip}-${srvc}.errtime
|
||||
# if [ ! -f ${TMPFOLDER}/${nip}.${srvc}.errtime ]; then
|
||||
# mv ${TMPFOLDER}/${nip}.${srvc}.down ${TMPFOLDER}/${nip}.${srvc}.errtime
|
||||
# fi
|
||||
# toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}-${srvc}.errtime)
|
||||
# toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}.${srvc}.errtime)
|
||||
# touch ${TMPFOLDER}/${nip}.${srvc}.down
|
||||
# if [ "${srvc}" = "mysql" ]; then
|
||||
# ${NCMD} systemctl restart ${srvc}
|
||||
@@ -284,8 +284,8 @@ STATUS(){
|
||||
# echo -e "${idsCL[Green]}Running${idsCL[Default]}"
|
||||
# fi
|
||||
# if [ -f ${TMPFOLDER}/${nip}.${srvc}.down ]; then
|
||||
# if [ -f ${TMPFOLDER}/${nip}-${srvc}.errtime ]; then
|
||||
# toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}-${srvc}.errtime)
|
||||
# if [ -f ${TMPFOLDER}/${nip}.${srvc}.errtime ]; then
|
||||
# toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}.${srvc}.errtime)
|
||||
# else
|
||||
# toterrtime=`date +%s`-$(stat -c %Y ${TMPFOLDER}/${nip}.${srvc}.down)
|
||||
# fi
|
||||
@@ -293,13 +293,13 @@ STATUS(){
|
||||
# echo "$(date) - ${nip} - ${NM_NODETYPES[$NTYPE]}-Node${nid} - ${NM_SERVICES[${srvc}]} is back up, it was down for $(SHOW_TIME ${toterrtime})" >> ${LOGFILE}
|
||||
#
|
||||
# rm -f ${TMPFOLDER}/${nip}.${srvc}.down
|
||||
# rm -f ${TMPFOLDER}/${nip}-${srvc}.errtime
|
||||
# rm -f ${TMPFOLDER}/${nip}.${srvc}.errtime
|
||||
#
|
||||
# fi
|
||||
# # if [ "${srvc}" == "pdnsadmin.socket" ] || [ "${srvc}" == "pdnsadmin" ] || [ "${srvc}" == "gitea" ]; then
|
||||
# if [ "${srvc}" == "gitea" ]; then
|
||||
# rm -f ${FOLDER}/*.${srvc}.down
|
||||
# rm -f ${FOLDER}/*-${srvc}.errtime
|
||||
# rm -f ${FOLDER}/*.${srvc}.errtime
|
||||
# fi
|
||||
# fi
|
||||
# [ "${mysqlgo}" = "true" ] && unset mysqlgo
|
||||
|
||||
Reference in New Issue
Block a user