From 195528d7c4eb1a9d1fed4866fe2fb1d88c170913 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Thu, 22 Aug 2024 19:27:31 -0500 Subject: [PATCH] update --- defaults.inc | 4 +++- inc/temp.inc.sh | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/defaults.inc b/defaults.inc index d995dfac..0a460987 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERS='2.7.89-08212024' +VERS='2.7.90-08222024' noheader=' update service dailytemp confsync -r -report test ' @@ -27,11 +27,13 @@ PW_LOGPOWER=${PW_LOGFOLDER}/log-power M_SRVCOPT=(start stop restart reload enable disable) source ${PW_FOLDER}/settings.conf + EMAIL_NOTICE=${PW_EMAIL_NOTICE} PUSHOVER_APP_TOKEN=${PW_PUSHOVER_APP_TOKEN} PUSHOVER_USER_TOKEN=${PW_PUSHOVER_USER_TOKEN} PW_FANINPUT=/sys/class/hwmon/hwmon3/fan1_input +[ "${PW_ENABLE_RENOTIFY}" == "" ] && PW_ENABLE_RENOTIFY=1 mqtt_conn="/usr/bin/mosquitto_sub -h 127.0.0.1 -u ${PW_MQTT_USER} -P ${PW_MQTT_PASS}" # mysql_conn="/usr/bin/mysql -h ${PW_MYSQL_HOST} -P 6033 --user=${PW_MYSQL_USER} --password=${PW_MYSQL_PASS}" diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index 7de70e41..0f1191da 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -1281,9 +1281,11 @@ Previous Temp: ${last_temp}${GAUGESH}" if [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.reading ]; then touch ${PW_TMPFOLDER}/${SENSOR}-error.reading elif [ ! -f ${PW_TMPFOLDER}/${SENSOR}.disable ] && (([ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.reading)) -ge 60 ]) || ([ -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.sent)) -ge $(echo "scale=0; ${PW_RENOTIFY_TIMEOUT}*60" | bc) ])); then - touch ${PW_TMPFOLDER}/${SENSOR}-error.sent - SENDNOTICE "${SENSOR} Sensor ERROR" "ERROR reading sensor data" 1 echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} Sensor - ERROR reading sensor data" >> ${logtemp} + if [ ${PW_ENABLE_RENOTIFY} -eq 1 ] || [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ]; then + SENDNOTICE "${SENSOR} Sensor ERROR" "ERROR reading sensor data" 1 + touch ${PW_TMPFOLDER}/${SENSOR}-error.sent + fi fi QRY="" @@ -1347,10 +1349,11 @@ Previous Temp: ${last_temp}${GAUGESH}" # fi elif [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] || ([ -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.sent)) -ge $(echo "scale=0; ${PW_RENOTIFY_TIMEOUT}*60" | bc) ]); then - touch ${PW_TMPFOLDER}/${SENSOR}-error.sent - SENDNOTICE "${SENSOR} Sensor ERROR" "ERROR reading sensor data" 1 echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} Sensor - ERROR reading sensor data" >> ${logtemp} - + if [ ${PW_ENABLE_RENOTIFY} -eq 1 ] || [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ]; then + SENDNOTICE "${SENSOR} Sensor ERROR" "ERROR reading sensor data" 1 + touch ${PW_TMPFOLDER}/${SENSOR}-error.sent + fi fi fi @@ -1386,9 +1389,11 @@ Previous Temp: ${last_temp}${GAUGESH}" if [ ! -f ${PW_TMPFOLDER}/${SENSORa}-error.reading ]; then touch ${PW_TMPFOLDER}/${SENSORa}-error.reading elif [ ! -f ${PW_TMPFOLDER}/${SENSORa}.disable ] && (([ ! -f ${PW_TMPFOLDER}/${SENSORa}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSORa}-error.reading)) -ge 60 ]) || ([ -f ${PW_TMPFOLDER}/${SENSORa}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSORa}-error.sent)) -ge $(echo "scale=0; ${PW_RENOTIFY_TIMEOUT}*60" | bc) ])); then - touch ${PW_TMPFOLDER}/${SENSORa}-error.sent - SENDNOTICE "${SENSORa} Sensor ERROR" "ERROR reading sensor data" 1 echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSORa} Sensor - ERROR reading sensor data" >> ${logtemp} + if [ ${PW_ENABLE_RENOTIFY} -eq 1 ] || [ ! -f ${PW_TMPFOLDER}/${SENSORa}-error.sent ]; then + SENDNOTICE "${SENSORa} Sensor ERROR" "ERROR reading sensor data" 1 + touch ${PW_TMPFOLDER}/${SENSORa}-error.sent + fi elif [ -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set ] && [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set)) -ge 900 ]; then rm -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set fi