Update temp.inc.sh

This commit is contained in:
2025-05-31 20:42:10 -05:00
parent f31cd276a9
commit 7841c2aad0

View File

@@ -542,11 +542,9 @@ CHECKTEMP(){
if [ ${DETAILS} -eq 1 ] && [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ] && [ "${temp_f}" != "timeout" ] && [ "${temp_f}" != "offline" ]; then
DIVIDER . white ${PRI_WIDTH}
for M in 5 15 30 60 120; do
echo "HERE: $M"
lico=" "
if [ "${mysql_conn}" != "" ]; then
entityid=($(${mysql_conn} -e "SELECT id FROM servermonitor.entities WHERE BINARY name='${sensorname// /_}' AND sensorid='${PW_SENSOR_ID[${SENSOR}]}'"))
echo $entityid
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]]; then
spc_cnt=6
[ "${mysql_conn}" != "" ] && OLD_temp_f=($(${mysql_conn} -e "SELECT speed,date FROM servermonitor.sensor_data WHERE sensorid='${PW_SENSOR_ID[${SENSOR}]}' AND entity=${entityid[1]} AND date >= DATE_SUB(NOW(), INTERVAL $(expr ${M} + 1) MINUTE) AND date <= DATE_SUB(NOW(), INTERVAL $(expr ${M} - 6) MINUTE) ORDER BY date ASC LIMIT 1"))
@@ -557,6 +555,7 @@ CHECKTEMP(){
OLD_temp_f=${OLD_temp_f[2]}
OLD_date=${OLD_temp_f[3]}
OLD_time=${OLD_temp_f[4]}
echo "HERE: $temp_f - $OLD_temp_f"
fi
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