Update temp.inc.sh

This commit is contained in:
2024-04-22 18:11:30 -05:00
parent 052418fa5f
commit 94a215b058

View File

@@ -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