diff --git a/defaults.inc b/defaults.inc index 0054911a..e8563699 100755 --- a/defaults.inc +++ b/defaults.inc @@ -7,6 +7,7 @@ noheader=' service status-check nightlyrenew backup report ' CERT_DAEMON='/usr/bin/certbot' FOLDER=/opt/idssys/nodemgmt SCRIPT=${FOLDER}/nodemgmt-scripts.sh +RENOTIFY=60 IFS=, NODE_HOSTS=(${NODEHOSTS}) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 45d646d2..e038a24a 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -208,10 +208,17 @@ STATUS-CHECK(){ fi for srvc in "${NODE_SERVICES[@]}"; do if [ "$(${NCMD} systemctl is-active ${srvc})" != "active" ]; then - # if [ ! -f ${FOLDER}/${nip}-${srvc}.down ]; then + if [ ! -f ${FOLDER}/${nip}-${srvc}.down ]; then echo "${NM_SERVICES[${srvc}]} is down" | mail -s "iDS-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL} touch ${FOLDER}/${nip}-${srvc}.down - # fi + else + declare -i errtime + errtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}-${srvc}.down) + echo "errtime: ${errtime}" + if [ $errtime -gt ${RENOTIFY} ]; then + echo "RENOTIFY" + fi + fi elif [ -f ${FOLDER}/${nip}-${srvc}.down ]; then echo "${NM_SERVICES[${srvc}]} is back UP!" | mail -s "iDS-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL} rm -f ${FOLDER}/${nip}-${srvc}.down diff --git a/run.sh b/run.sh index f64145b5..05845e7d 100755 --- a/run.sh +++ b/run.sh @@ -13,7 +13,6 @@ fi source /opt/idssys/nodemgmt/defaults.inc if [[ "${noheader}" != *" ${action} "* ]] && [[ "${noheader}" != *" ${2} "* ]]; then -#if [ "$1" != "service" ] && [ "$1" != "status-check" ] && [ "$1" != "nightlyrenew" ] && [ "$1" != "backup" ] && [ "$2" != "report" ]; then if [ "${1}" = "gui" ]; then DISP_HEADER fi