From 94a215b058eb60229f7d9b01794c7f4521cfe9c6 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 22 Apr 2024 18:11:30 -0500 Subject: [PATCH] Update temp.inc.sh --- inc/temp.inc.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index 1b1d29da..8ee67f2a 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -1001,19 +1001,6 @@ Previous Temp: ${last_temp}${GAUGESH}" if [ "${QRY}" != "" ]; then ${mysql_conn} -e "${QRY}" echo "${temp_f}" >| ${PW_TMPFOLDER}/.lastinsert/${SENSOR} - if [[ "${SENSOR}" != *"CPU"* ]] && [[ "${SENSOR}" != *"FAN"* ]]; then - if [ ! -f ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre ]; then - echo "${temp_f}" > ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre - - elif ([ ! -f ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre)) -ge 1800 ]) || ([ -f ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old)) -ge 1800 ]); then - mv ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old 2> /dev/null - echo "${temp_f}" > ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre - - fi - else - rm -f {PW_TMPFOLDER}/.lastinsert/${SENSOR}.* - fi - fi # if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then @@ -1021,6 +1008,19 @@ Previous Temp: ${last_temp}${GAUGESH}" # fi fi + if [ "${temp_f}" != "" ] && [[ "${SENSOR}" != *"CPU"* ]] && [[ "${SENSOR}" != *"FAN"* ]]; then + if [ ! -f ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre ]; then + echo "${temp_f}" > ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre + + elif ([ ! -f ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre)) -ge 1800 ]) || ([ -f ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old)) -ge 1800 ]); then + mv ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old 2> /dev/null + echo "${temp_f}" > ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.pre + + fi + else + rm -f {PW_TMPFOLDER}/.lastinsert/${SENSOR}.* + fi + #### LOGGING OF SERVERROOM SENSOR DIFFERENCE if [ "${SENSOR}" == "ServerRoom-Rear" ]; then if [ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.log.sr.difference)) -ge 300 ]; then