From 8961867b7059898eb458ec91144a635912656c19 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 27 Aug 2024 22:11:34 -0500 Subject: [PATCH] Update temp.inc.sh --- inc/temp.inc.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index 68be6048..e15722d3 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -1347,7 +1347,7 @@ Previous Temp: ${last_temp}${GAUGESH}" if [ ! -f ${NM_TMPFOLDER}/${SENSOR}.disable ] && ([ "${PW_ESXI_HOST_NAME[${SENSORa}]}" == "" ] || ([[ "${PW_ESXI_HOST_NAME[${SENSORa}]}" != *"10.2."* ]] || ([[ "${PW_ESXI_HOST_NAME[${SENSORa}]}" = *"10.2."* ]] && [ ! -f ${PW_TMPFOLDER}/OFF-vMS-Host1.down ]))); then [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ] && touch ${PW_TMPFOLDER}/${SENSOR}.down if [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.reading ]; then - #touch ${PW_TMPFOLDER}/${SENSOR}-error.reading + touch ${PW_TMPFOLDER}/${SENSOR}-error.reading elif [ ! -f ${PW_TMPFOLDER}/${SENSOR}.disable ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.reading)) -ge 60 ]; then if [ "${SENSOR}" == "ServerRoomTemp" ] && ([ ! -f ${PW_TMPFOLDER}/${SENSOR}.restart ] || ([ -f ${PW_TMPFOLDER}/${SENSOR}.restart ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}.restart)) -ge 900 ])); then @@ -1396,17 +1396,19 @@ Previous Temp: ${last_temp}${GAUGESH}" fi else - [ ! -f ${PW_TMPFOLDER}/${SENSORa}.down ] && touch ${PW_TMPFOLDER}/${SENSORa}.down - 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 - 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 + if [ ! -f ${NM_TMPFOLDER}/${SENSORa}.disable ] && ([ "${PW_ESXI_HOST_NAME[${SENSORa}]}" == "" ] || ([[ "${PW_ESXI_HOST_NAME[${SENSORa}]}" != *"10.2."* ]] || ([[ "${PW_ESXI_HOST_NAME[${SENSORa}]}" = *"10.2."* ]] && [ ! -f ${PW_TMPFOLDER}/OFF-vMS-Host1.down ]))); then + [ ! -f ${PW_TMPFOLDER}/${SENSORa}.down ] && touch ${PW_TMPFOLDER}/${SENSORa}.down + 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 + 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 [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ] && [ -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set)) -ge 900 ]; then + rm -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set 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 fi rm -f ${PW_TMPFOLDER}/ztemprun.${SENSORa}.running