Update temp.inc.sh
This commit is contained in:
@@ -343,6 +343,20 @@ CHECKTEMP_SERVICE(){
|
|||||||
(( $(bc <<<"${temp_f} < 1") )) && [[ "${temp_f}" = *"."* ]] && temp_f="0${temp_f}"
|
(( $(bc <<<"${temp_f} < 1") )) && [[ "${temp_f}" = *"."* ]] && temp_f="0${temp_f}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#### LOGGING OF SERVERROOM SENSOR DIFFERENCE
|
||||||
|
if [ "${SENSOR}" == "ServerRoomLA" ]; then
|
||||||
|
if [ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.log.sr.difference)) -ge 300 ]; then
|
||||||
|
[ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] && touch ${PW_TMPFOLDER}/.log.sr.difference
|
||||||
|
temp_difference=$(bc <<< "scale=1; ${temp_probe_f}-${ServerRoomTH}")
|
||||||
|
(( $(bc <<<"${temp_difference} < 0") )) && temp_difference=`echo "scale=1; ${temp_difference} * -1" | bc`
|
||||||
|
echo "HERE: ${temp_probe_f} - ${ServerRoomTH} = ${temp_difference}"
|
||||||
|
echo ${temp_difference} >> ${PW_TMPFOLDER}/.log.sr.difference
|
||||||
|
fi
|
||||||
|
elif [ "${SENSOR}" == "ServerRoomTH" ]; then
|
||||||
|
ServerRoomTH=${temp_f}
|
||||||
|
fi
|
||||||
|
###################
|
||||||
|
|
||||||
# echo "HERE: [${SENSOR//-/}] - ${last_temp[${SENSOR//-/}]} - ${temp_c} - ${temp_f} - ${temp_warn} - ${temp_crit} - ${temp_crit_sys}"
|
# echo "HERE: [${SENSOR//-/}] - ${last_temp[${SENSOR//-/}]} - ${temp_c} - ${temp_f} - ${temp_warn} - ${temp_crit} - ${temp_crit_sys}"
|
||||||
# [ ! "${temp_c}" ] || [ ! "${temp_f}" ] || [ ! "${temp_warn}" ] || [ ! "${temp_crit}" ] || [ ! "${temp_crit_sys}" ] && echo "VALUE NOT FOUND"
|
# [ ! "${temp_c}" ] || [ ! "${temp_f}" ] || [ ! "${temp_warn}" ] || [ ! "${temp_crit}" ] || [ ! "${temp_crit_sys}" ] && echo "VALUE NOT FOUND"
|
||||||
|
|
||||||
@@ -475,20 +489,6 @@ Previous Temp: ${last_temp[${SENSOR//-/}]}${GAUGESH}"
|
|||||||
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then
|
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then
|
||||||
temp_probe_f=$(bc <<< "scale=1; ${temp_probe_c}*1.8+32")
|
temp_probe_f=$(bc <<< "scale=1; ${temp_probe_c}*1.8+32")
|
||||||
${mysql_conn} -e "USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID["${SENSORa}-Probe"]}','$(date +'%Y-%m-%d %H:%M:%S')','${temp_probe_f}')"
|
${mysql_conn} -e "USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID["${SENSORa}-Probe"]}','$(date +'%Y-%m-%d %H:%M:%S')','${temp_probe_f}')"
|
||||||
|
|
||||||
#### LOGGING OF SERVERROOM SENSOR DIFFERENCE
|
|
||||||
if [ "${SENSOR}" == "ServerRoomLA" ] && ([ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.log.sr.difference)) -ge 300 ]); then
|
|
||||||
[ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] && touch ${PW_TMPFOLDER}/.log.sr.difference
|
|
||||||
temp_difference=$(bc <<< "scale=1; ${temp_probe_f}-${ServerRoomTH}")
|
|
||||||
(( $(bc <<<"${temp_difference} < 0") )) && temp_difference=`echo "scale=1; ${temp_difference} * -1" | bc`
|
|
||||||
echo "HERE: ${temp_probe_f} - ${ServerRoomTH} = ${temp_difference}"
|
|
||||||
echo ${temp_difference} >> ${PW_TMPFOLDER}/.log.sr.difference
|
|
||||||
fi
|
|
||||||
###################
|
|
||||||
elif [ "${SENSOR}" == "ServerRoomTH" ]; then
|
|
||||||
#### LOGGING OF SERVERROOM SENSOR DIFFERENCE
|
|
||||||
ServerRoomTH=${temp_f}
|
|
||||||
##############
|
|
||||||
fi
|
fi
|
||||||
touch ${PW_TMPFOLDER}/${SENSOR}.insert
|
touch ${PW_TMPFOLDER}/${SENSOR}.insert
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user