diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index fc4d029b..ad279113 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -219,22 +219,42 @@ CHECKTEMP(){ OLD_temp_f=($(${mysql_conn} -e "SELECT temp FROM servermonitor.sensor_data WHERE sensorid='${PW_SENSOR_ID[${SENSOR}]}' AND date >= DATE_SUB(NOW(), INTERVAL ${M} MINUTE) AND date <= DATE_SUB(NOW(), INTERVAL $(expr ${M} - 7) MINUTE) ORDER BY date ASC LIMIT 1")) if [ $(bc -l <<< "${temp_f} < $(echo "scale=2; ${OLD_temp_f[1]}+${PW_TEMPIND_DIFF}" | bc)") -eq 1 ] && [ $(bc -l <<< "$(echo "scale=2; ${OLD_temp_f[1]}-${PW_TEMPIND_DIFF}" | bc) < ${temp_f}") -eq 1 ]; then lclr="${idsCL[White]}" + lico=" " elif [ $(bc -l <<< "$(bc <<< "scale=2; ${OLD_temp_f[1]}+(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then lclr="${idsCL[LightRed]}" + lico="\u25B2" elif [ $(bc -l <<< "${OLD_temp_f[1]} < ${temp_f}") -eq 1 ]; then lclr="${idsCL[Magenta]}" + lico="\u25B2" elif [ $(bc -l <<< "${temp_f} < $(bc <<< "scale=2; ${OLD_temp_f[1]}-(${PW_TEMPIND_DIFF}*2)")") -eq 1 ]; then lclr="${idsCL[LightGreen]}" + lico="\u25BC" elif [ $(bc -l <<< "${temp_f} < ${OLD_temp_f[1]}") -eq 1 ]; then lclr="${idsCL[LightCyan]}" + lico="\u25BC" else lclr="${idsCL[Default]}" + lico=" " fi ([ "${temp_h}" != "" ] && [ "${temp_h}" != "0" ]) && echo -en "${idsCL[White]}| " || echo -n " " [ ${#M} -eq 2 ] && echo -n " " - echo -e "${idsCL[White]} ${lclr}${M} Mins Ago ${OLD_temp_f[1]}${GAUGESH}" + echo -e "${idsCL[White]} ${lclr}${M} Mins Ago ${lico} ${OLD_temp_f[1]}${GAUGESH}" done + if [ $(bc -l <<< "${temp_f} < $(echo "scale=2; ${OLD_temp_f[1]}+${PW_TEMPIND_DIFF}" | bc)") -eq 1 ] && [ $(bc -l <<< "$(echo "scale=2; ${OLD_temp_f[1]}-${PW_TEMPIND_DIFF}" | bc) < ${temp_f}") -eq 1 ]; then + lclr="${idsCL[White]}" + elif [ $(bc -l <<< "$(bc <<< "scale=2; ${OLD_temp_f[1]}+(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then + lclr="${idsCL[LightRed]}\u25B2 " + elif [ $(bc -l <<< "${OLD_temp_f[1]} < ${temp_f}") -eq 1 ]; then + lclr="${idsCL[Magenta]}\u25B2 " + elif [ $(bc -l <<< "${temp_f} < $(bc <<< "scale=2; ${OLD_temp_f[1]}-(${PW_TEMPIND_DIFF}*2)")") -eq 1 ]; then + lclr="${idsCL[LightGreen]}\u25BC " + elif [ $(bc -l <<< "${temp_f} < ${OLD_temp_f[1]}") -eq 1 ]; then + echo -en "${idsCL[LightCyan]}\u25BC " + else + echo -en " " + fi + fi if [ "${temp_h}" != "" ] && [ "${temp_h}" != "0" ]; then