diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index c5310ba8..1f0e0b42 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -626,13 +626,14 @@ CHECKTEMP_SERVICE_RUNSENSOR(){ echo -en "PRobe found - " if [ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.log.sr.difference)) -ge 300 ]; then echo -en "logs good - " - if [ "${temp_f}" != "" ] && [ "${ServerRoomTH}" != "" ]; then + if [ "${temp_f}" != "" ] && [ -f ${PW_TMPFOLDER}/.serveroomth ]; then echo -en "temp good" [ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] && touch ${PW_TMPFOLDER}/.log.sr.difference - temp_difference=$(bc <<< "scale=2; ${ServerRoomTH}-${temp_f}") + temp_difference=$(bc <<< "scale=2; $(cat ${PW_TMPFOLDER}/.serveroomth)-${temp_f}") # (( $(bc <<<"${temp_difference} < 0") )) && temp_difference=`echo "scale=2; ${temp_difference} * -1" | bc` # echo "$(date "+%Y-%m-%d %H:%M:%S")~${temp_difference}" >> ${PW_TMPFOLDER}/.log.sr.difference - echo "[$(date +'%Y-%m-%d %H:%M:%S')] ${temp_f} - ${ServerRoomTH} = ${temp_difference}" + echo "[$(date +'%Y-%m-%d %H:%M:%S')] ${temp_f} - $(cat ${PW_TMPFOLDER}/.serveroomth) = ${temp_difference}" + rm -f ${PW_TMPFOLDER}/.serveroomth else echo "temp not good (${temp_f} - ${ServerRoomTH})" fi @@ -640,7 +641,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){ echo "logs not good" fi elif [ "${SENSOR}" == "ServerRoomTH" ]; then - export ServerRoomTH=${temp_f} + echo ${temp_f} > ${PW_TMPFOLDER}/.serveroomth echo "srth found - ${ServerRoomTH}" fi ###################