Update temp.inc.sh

This commit is contained in:
2024-04-22 21:58:12 -05:00
parent d0fa45313f
commit 32160e3c30

View File

@@ -144,10 +144,14 @@ CHECKTEMP(){
if [ -f ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old2 ]; then
if [ $(bc -l <<< "${temp_f} <= $(echo "scale=2; $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old2 | cut -d'~' -f 1)+${PW_TEMPIND_DIFF}" | bc)") -eq 1 ] && [ $(bc -l <<< "${temp_f} >= $(echo "scale=2; $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old2 | cut -d'~' -f 1)-${PW_TEMPIND_DIFF}" | bc)") -eq 1 ]; then
reading="${reading}${idsCL[White]}\u23F9 "
elif [ $(bc -l <<< "$(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old2 | cut -d'~' -f 1) < ${temp_f}") -eq 1 ]; then
elif [ $(bc -l <<< "$(bc <<< "scale=2; $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old2 | cut -d'~' -f 1)+(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then
reading="${reading}${idsCL[LightRed]}\u25B2 "
elif [ $(bc -l <<< "${temp_f} < $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old2 | cut -d'~' -f 1)") -eq 1 ]; then
elif [ $(bc -l <<< "$(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old2 | cut -d'~' -f 1) < ${temp_f}") -eq 1 ]; then
reading="${reading}${idsCL[Magenta]}\u25B2 "
elif [ $(bc -l <<< "${temp_f} < $(bc <<< "scale=2; $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old2 | cut -d'~' -f 1)-(${PW_TEMPIND_DIFF}*2)")") -eq 1 ]; then
reading="${reading}${idsCL[LightGreen]}\u25BC "
elif [ $(bc -l <<< "${temp_f} < $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}.old2 | cut -d'~' -f 1)") -eq 1 ]; then
reading="${reading}${idsCL[LightCyan]}\u25BC "
else
reading="${reading} "
fi
@@ -318,24 +322,32 @@ CHECKTEMP(){
c=0; spct=''; spc1=`expr 7 - ${#temp_f}`; until [ ${c} = ${spc1} ]; do spct="${spct} "; c=`expr ${c} + 1`; done
reading="${lclr}${lmd}${spct}${temp_f}${GAUGESH}"
echo -en "${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: ${reading}"
if [ "${temp_f}" != "" ] && [ "${average}" = "" ] && [ -f ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old ]; then
if [ $(bc -l <<< "${temp_f} <= $(echo "scale=2; $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old | cut -d'~' -f 1)+${PW_TEMPIND_DIFF}" | bc)") -eq 1 ] && [ $(bc -l <<< "${temp_f} >= $(echo "scale=2; $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old | cut -d'~' -f 1)-${PW_TEMPIND_DIFF}" | bc)") -eq 1 ]; then
echo -en " ${idsCL[White]}\u23F9 "
elif [ $(bc -l <<< "$(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old | cut -d'~' -f 1) < ${temp_f}") -eq 1 ]; then
elif [ $(bc -l <<< "$(bc <<< "scale=2; $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old | cut -d'~' -f 1)+(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then
echo -en " ${idsCL[LightRed]}\u25B2 "
elif [ $(bc -l <<< "${temp_f} < $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old | cut -d'~' -f 1)") -eq 1 ]; then
elif [ $(bc -l <<< "$(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old | cut -d'~' -f 1) < ${temp_f}") -eq 1 ]; then
echo -en " ${idsCL[Magenta]}\u25B2 "
elif [ $(bc -l <<< "$(bc <<< "scale=2; $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old | cut -d'~' -f 1)-(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then
echo -en " ${idsCL[LightGreen]}\u25BC "
elif [ $(bc -l <<< "${temp_f} < $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old | cut -d'~' -f 1)") -eq 1 ]; then
echo -en " ${idsCL[LightCyan]}\u25BC "
else
echo -en " "
fi
if [ -f ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old2 ]; then
if [ $(bc -l <<< "${temp_f} <= $(echo "scale=2; $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old2 | cut -d'~' -f 1)+${PW_TEMPIND_DIFF}" | bc)") -eq 1 ] && [ $(bc -l <<< "${temp_f} >= $(echo "scale=2; $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old2 | cut -d'~' -f 1)-${PW_TEMPIND_DIFF}" | bc)") -eq 1 ]; then
echo -en "${idsCL[White]}\u23F9 "
elif [ $(bc -l <<< "$(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old2 | cut -d'~' -f 1) < ${temp_f}") -eq 1 ]; then
elif [ $(bc -l <<< "$(bc <<< "scale=2; $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old2 | cut -d'~' -f 1)+(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then
echo -en "${idsCL[LightRed]}\u25B2 "
elif [ $(bc -l <<< "${temp_f} < $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old2 | cut -d'~' -f 1)") -eq 1 ]; then
elif [ $(bc -l <<< "$(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old2 | cut -d'~' -f 1) < ${temp_f}") -eq 1 ]; then
echo -en "${idsCL[Magenta]}\u25B2 "
elif [ $(bc -l <<< "$(bc <<< "scale=2; $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old2 | cut -d'~' -f 1)-(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then
echo -en "${idsCL[LightGreen]}\u25BC "
elif [ $(bc -l <<< "${temp_f} < $(cat ${PW_TMPFOLDER}/.lastinsert/${SENSOR}-${sensorname// /_}.old2 | cut -d'~' -f 1)") -eq 1 ]; then
echo -en "${idsCL[LightCyan]}\u25BC "
else
echo -en " "
fi
@@ -392,10 +404,14 @@ CHECKTEMP(){
echo -e " Goldilock Zone : ${idsCL[LightGreen]}${ESXI_DEFAULT_EXHAUST_MIN}°F (±${ESXI_FANSPEED_GL_ZONE}°F)"
echo -e " Last checked : ${idsCL[LightCyan]}$(date -r ${PW_TMPFOLDER}/.lastfancheck/${SENSOR} "+%m/%d @ %l:%M%p")${idsCL[Default]}"
echo -en " Last set : ${FSC}$(date -r ${PW_TMPFOLDER}/.lastfancheck/${SENSOR}.set "+%m/%d @ %l:%M%p") "
if [ "$(cat ${PW_TMPFOLDER}/.lastfancheck/${SENSOR}.set | cut -d'~' -f 2)" == "u" ]; then
if [ "$(cat ${PW_TMPFOLDER}/.lastfancheck/${SENSOR}.set | cut -d'~' -f 2)" == "uu" ]; then
echo -e "${idsCL[LightRed]}\u25B2 ${idsCL[Default]}"
elif [ "$(cat ${PW_TMPFOLDER}/.lastfancheck/${SENSOR}.set | cut -d'~' -f 2)" == "u" ]; then
echo -e "${idsCL[Magenta]}\u25B2 ${idsCL[Default]}"
elif [ "$(cat ${PW_TMPFOLDER}/.lastfancheck/${SENSOR}.set | cut -d'~' -f 2)" == "dd" ]; then
echo -e "${idsCL[LightGreen]}\u25BC ${idsCL[Default]}"
elif [ "$(cat ${PW_TMPFOLDER}/.lastfancheck/${SENSOR}.set | cut -d'~' -f 2)" == "d" ]; then
echo -e "\u25BC ${idsCL[Default]}"
echo -e "${idsCL[LightCyan]}\u25BC ${idsCL[Default]}"
else
echo -e "${idsCL[Default]}"
fi
@@ -1136,9 +1152,17 @@ SET_ESXI_FANSPEED(){
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${fan} - ${SET_HOST} - ${MSG}" >> ${PW_LOGFOLDER}/esxi-fanspeeds.log
if [ $(bc -l <<< "${SET_FanSpeed} < $(cat ${PW_TMPFOLDER}/.lastfancheck/${SET_HOST}.set | cut -d'~' -f 1)") -eq 1 ]; then
echo "${SET_FanSpeed}~d" >| ${PW_TMPFOLDER}/.lastfancheck/${SET_HOST}.set
if [ ${FAN_DECREASE} -eq 5 ]; then
echo "${SET_FanSpeed}~d" >| ${PW_TMPFOLDER}/.lastfancheck/${SET_HOST}.set
else
echo "${SET_FanSpeed}~dd" >| ${PW_TMPFOLDER}/.lastfancheck/${SET_HOST}.set
fi
elif [ $(bc -l <<< "$(cat ${PW_TMPFOLDER}/.lastfancheck/${SET_HOST}.set | cut -d'~' -f 1) < ${SET_FanSpeed}") -eq 1 ]; then
echo "${SET_FanSpeed}~u" >| ${PW_TMPFOLDER}/.lastfancheck/${SET_HOST}.set
if [ ${FAN_INCREASE} -eq 5 ]; then
echo "${SET_FanSpeed}~u" >| ${PW_TMPFOLDER}/.lastfancheck/${SET_HOST}.set
else
echo "${SET_FanSpeed}~uu" >| ${PW_TMPFOLDER}/.lastfancheck/${SET_HOST}.set
fi
else
echo "${SET_FanSpeed}~e" >| ${PW_TMPFOLDER}/.lastfancheck/${SET_HOST}.set
fi