Update temp.inc.sh

This commit is contained in:
2025-03-09 12:19:16 -05:00
parent 19aa7b0875
commit f24a30a9bc

View File

@@ -118,7 +118,6 @@ CHECKTEMP(){
[ ${REPORT} -eq 0 ] && echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR_DESC}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Pulling data ... "
if [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ]; then
echo $(CHECKTEMPSENSOR ${SENSOR})
IFS=: read -r temp_f temp_h <<< $(CHECKTEMPSENSOR ${SENSOR}); unset IFS
if [ "${temp_f}" != "timeout" ] && [ "${temp_f}" != "offline" ]; then
[ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]] && temp_f_disp=$(IDS_NUMBER_FORMAT ${temp_f} 0) || temp_f_disp=${temp_f}
@@ -133,7 +132,6 @@ CHECKTEMP(){
lmd="Normal "
fi
c=0; spct=''; [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]] && spc1=`expr 6 - ${#temp_f}` || spc1=`expr 7 - ${#temp_f}`
echo "${temp_f} = ${#temp_f}"
until [ ${c} = ${spc1} ]; do spct="${spct} "; ((c++)); done
reading="${lclr}${lmd}${spct}"$(IDS_NUMBER_FORMAT ${temp_f})"${GAUGESH}"
[ ${REPORT} -eq 0 ] && echo -en "\r\033[K"
@@ -143,7 +141,7 @@ CHECKTEMP(){
for R in ${PW_TEMPIND_RANGE[@]}; do
OLD_temp_f=($(${mysql_conn} -e "SELECT temp FROM servermonitor.sensor_data WHERE sensorid='${PW_SENSOR_ID[${SENSOR}]}' 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"))
if [ "${OLD_temp_f[1]}" != "" ]; then
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
if [ $(bc -l <<< "${temp_f} < $(echo "scale=2; (${OLD_temp_f[1]}+${PW_TEMPIND_DIFF})/1" | bc)") -eq 1 ] && [ $(bc -l <<< "$(echo "scale=2; ${OLD_temp_f[1]}-${PW_TEMPIND_DIFF}" | bc) < ${temp_f}") -eq 1 ]; then
echo -en "${idsCL[White]}\u23F9 "
elif [ $(bc -l <<< "$(bc <<< "scale=2; ${OLD_temp_f[1]}+(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then
echo -en "${idsCL[LightRed]}\u25B2 "
@@ -425,7 +423,7 @@ CHECKTEMP(){
unset IFS
echo -en "\r\033[K"
if [ ${#vHOST_TEMPNAMES[@]} -gt 1 ]; then
if [ ${#vHOST_TEMPNAdMES[@]} -gt 1 ]; then
t=1
for sensorname in "${vHOST_TEMPNAMES[@]}"; do
# if [ "${TTYPE}" != "fans" ] || ([ "${TTYPE}" == "fans" ] && ([[ "${sensorname}" = *"Exhaust"* ]] || ([ "${SENSOR}" == "iDS-vMS-Host6" ] && [[ "${sensorname}" = *"Inlet"* ]]))); then
@@ -729,14 +727,14 @@ CHECKTEMPSENSOR(){
if [ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ]; then
if [ "${1}" == "ServerRoomTH" ]; then
temp_f=`echo "scale=2; (${temp_c}*(9/5))+32+${PW_ServerRoomTH_Dev}" | bc`
temp_f=`echo "scale=2; ((${temp_c}*(9/5))+32+${PW_ServerRoomTH_Dev})/1" | bc`
else
if [ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ]; then
temp_f=$(echo "scale=2; $temp_c/1" | bc -l)
elif [ "${PW_SENSOR_TYPE[${1}]}" == "system" ] && [[ "${1}" = *"FAN"* ]]; then
temp_f=${temp_c}
elif [ "${temp_f}" == "" ]; then
temp_f=$(bc <<< "scale=2; (${temp_c}*(9/5))+32")
temp_f=$(bc <<< "scale=2; ((${temp_c}*(9/5))+32)/1")
fi
(( $(bc <<<"${temp_f} < 1") )) && [[ "${temp_f}" = *"."* ]] && temp_f="0${temp_f}"
fi