From 9c05062ce5e02e3507e8c5482906b4cf5d3bdc8f Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 31 May 2025 20:56:47 -0500 Subject: [PATCH] Update temp.inc.sh --- inc/temp.inc.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index bfe37cad..ca9e15ab 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -478,17 +478,17 @@ CHECKTEMP(){ for R in ${PW_TEMPIND_RANGE[@]}; do [ "${mysql_conn}" != "" ] && entityid=($(${mysql_conn} -e "SELECT id FROM servermonitor.entities WHERE BINARY name='${sensorname// /_}' AND sensorid='${PW_SENSOR_ID[${SENSOR}]}'")) [ "${mysql_conn}" != "" ] && OLD_temp_f=($(${mysql_conn} -e "SELECT temp FROM servermonitor.sensor_data WHERE sensorid='${PW_SENSOR_ID[${SENSOR}]}' AND entity=${entityid[1]} AND date >= DATE_SUB(NOW(), INTERVAL $(expr ${R} + 1) MINUTE) AND date <= DATE_SUB(NOW(), INTERVAL $(expr ${R} - 6) MINUTE) ORDER BY date ASC LIMIT 1")) - echo "HERE: ${OLD_temp_f[0]} - ${OLD_temp_f[1]}" - if [ "${OLD_temp_f[1]}" != "" ]; then - if [ $(bc -l <<< "${temp_f} < $(echo "scale=2; ${OLD_temp_f[0]}+${PW_TEMPIND_DIFF}" | bc)") -eq 1 ] && [ $(bc -l <<< "$(echo "scale=2; ${OLD_temp_f[0]}-${PW_TEMPIND_DIFF}" | bc) < ${temp_f}") -eq 1 ]; then + [[ "${IP}" == "10.6.1"* ]] && OLD_temp_f=${OLD_temp_f[0]} || OLD_temp_f=${OLD_temp_f[1]} + if [ "${OLD_temp_f}" != "" ]; then + if [ $(bc -l <<< "${temp_f} < $(echo "scale=2; ${OLD_temp_f}+${PW_TEMPIND_DIFF}" | bc)") -eq 1 ] && [ $(bc -l <<< "$(echo "scale=2; ${OLD_temp_f}-${PW_TEMPIND_DIFF}" | bc) < ${temp_f}") -eq 1 ]; then echo -en "${idsCL[White]}\u23F9 " - elif [ $(bc -l <<< "$(bc <<< "scale=2; ${OLD_temp_f[0]}+(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then + elif [ $(bc -l <<< "$(bc <<< "scale=2; ${OLD_temp_f}+(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then echo -en "${idsCL[LightRed]}\u25B2 " - elif [ $(bc -l <<< "${OLD_temp_f[0]} < ${temp_f}") -eq 1 ]; then + elif [ $(bc -l <<< "${OLD_temp_f} < ${temp_f}") -eq 1 ]; then echo -en "${idsCL[Magenta]}\u25B2 " - elif [ $(bc -l <<< "${temp_f} < $(bc <<< "scale=2; ${OLD_temp_f[0]}-(${PW_TEMPIND_DIFF}*2)")") -eq 1 ]; then + elif [ $(bc -l <<< "${temp_f} < $(bc <<< "scale=2; ${OLD_temp_f}-(${PW_TEMPIND_DIFF}*2)")") -eq 1 ]; then echo -en "${idsCL[LightGreen]}\u25BC " - elif [ $(bc -l <<< "${temp_f} < ${OLD_temp_f[0]}") -eq 1 ]; then + elif [ $(bc -l <<< "${temp_f} < ${OLD_temp_f}") -eq 1 ]; then echo -en "${idsCL[LightCyan]}\u25BC " else echo -en " "