Update temp.inc.sh
This commit is contained in:
@@ -106,24 +106,31 @@ CHECKTEMP(){
|
|||||||
|
|
||||||
[ "${last_sensor%%-*}" == "${SENSOR%%-*}" ] && [ "${last_sensor}" != "Offsite-ServerRoom" ] && echo -en "\033[1A"
|
[ "${last_sensor%%-*}" == "${SENSOR%%-*}" ] && [ "${last_sensor}" != "Offsite-ServerRoom" ] && echo -en "\033[1A"
|
||||||
c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
|
c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
|
||||||
if [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ]; then
|
# if [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ]; then
|
||||||
echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Pulling data ... "
|
echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Pulling data ... "
|
||||||
temp_f=$(CHECKTEMPSENSOR ${SENSOR})
|
if [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ]; then
|
||||||
|
temp_f=$(CHECKTEMPSENSOR ${SENSOR})
|
||||||
c=0; spct=''; [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]] && spc1=`expr 5 - ${#temp_f}` || spc1=`expr 6 - ${#temp_f}`
|
[ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]] && temp_f_disp=$(IDS_NUMBER_FORMAT ${temp_f} 0) || temp_f_disp=${temp_f}
|
||||||
until [ ${c} = ${spc1} ]; do spct="${spct} "; c=`expr ${c} + 1`; done
|
if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then
|
||||||
[ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]] && temp_f_disp=$(IDS_NUMBER_FORMAT ${temp_f} 0) || temp_f_disp=${temp_f}
|
lclr="${idsCL[Yellow]}"
|
||||||
if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then
|
lmd="WARNING "
|
||||||
lclr="${idsCL[Yellow]}"
|
elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ]; then
|
||||||
lmd="WARNING "
|
lclr="${idsCL[LightRed]}"
|
||||||
elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ]; then
|
lmd="CRITICAL"
|
||||||
lclr="${idsCL[LightRed]}"
|
else
|
||||||
lmd="CRITICAL"
|
lclr="${idsCL[Green]}"
|
||||||
|
lmd="Normal "
|
||||||
|
fi
|
||||||
|
c=0; spct=''; [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]] && spc1=`expr 5 - ${#temp_f}` || spc1=`expr 6 - ${#temp_f}`
|
||||||
|
until [ ${c} = ${spc1} ]; do spct="${spct} "; c=`expr ${c} + 1`; done
|
||||||
|
reading="${lclr}${lmd}${spct}${temp_f_disp}${GAUGESH}"
|
||||||
else
|
else
|
||||||
lclr="${idsCL[Green]}"
|
temp_f=""
|
||||||
lmd="Normal "
|
lclr="${idsCL[Yellow]}"
|
||||||
|
lmd=""
|
||||||
|
reading="${idsCL[Yellow]}Sensor Offline"
|
||||||
fi
|
fi
|
||||||
reading="${lclr}${lmd}${spct}${temp_f_disp}${GAUGESH}"
|
|
||||||
|
|
||||||
echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${reading}${idsCL[Default]}"
|
echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${reading}${idsCL[Default]}"
|
||||||
if [ "${avgdays}" != "noavg" ]; then
|
if [ "${avgdays}" != "noavg" ]; then
|
||||||
@@ -158,25 +165,25 @@ CHECKTEMP(){
|
|||||||
else
|
else
|
||||||
echo -e "${idsCL[Default]}"
|
echo -e "${idsCL[Default]}"
|
||||||
fi
|
fi
|
||||||
else
|
# else
|
||||||
if [ "${avgdays}" != "noavg" ]; then
|
# if [ "${avgdays}" != "noavg" ]; then
|
||||||
average=$(AVERAGETEMP ${SENSOR} ${avgdays})
|
# average=$(AVERAGETEMP ${SENSOR} ${avgdays})
|
||||||
([ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]]) && average_disp=$(IDS_NUMBER_FORMAT ${average}) || average_disp=${average}
|
# ([ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]]) && average_disp=$(IDS_NUMBER_FORMAT ${average}) || average_disp=${average}
|
||||||
c=0; spca=''; spc1=`expr 6 - ${#average_disp}`; until [ ${c} = ${spc1} ]; do spca="${spca} "; c=`expr ${c} + 1`; done
|
# c=0; spca=''; spc1=`expr 6 - ${#average_disp}`; until [ ${c} = ${spc1} ]; do spca="${spca} "; c=`expr ${c} + 1`; done
|
||||||
if [ "${average_disp}" == "" ]; then
|
# if [ "${average_disp}" == "" ]; then
|
||||||
averagedisp="${idsCL[Green]}"
|
# averagedisp="${idsCL[Green]}"
|
||||||
elif [ $(bc -l <<< "${average} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${average} < ${temp_crit}") -eq 1 ]; then
|
# elif [ $(bc -l <<< "${average} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${average} < ${temp_crit}") -eq 1 ]; then
|
||||||
averagedisp="${idsCL[Yellow]}${average}"
|
# averagedisp="${idsCL[Yellow]}${average}"
|
||||||
elif [ $(bc -l <<< "${average} >= ${temp_crit}") -eq 1 ]; then
|
# elif [ $(bc -l <<< "${average} >= ${temp_crit}") -eq 1 ]; then
|
||||||
averagedisp="${idsCL[LightRed]}${average_disp}"
|
# averagedisp="${idsCL[LightRed]}${average_disp}"
|
||||||
else
|
# else
|
||||||
averagedisp="${idsCL[Green]}${average_disp}"
|
# averagedisp="${idsCL[Green]}${average_disp}"
|
||||||
fi
|
# fi
|
||||||
echo -e "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Sensor Offline /${spca}${averagedisp}${GAUGESH}${idsCL[Default]}"
|
# echo -e "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Sensor Offline /${spca}${averagedisp}${GAUGESH}${idsCL[Default]}"
|
||||||
else
|
# else
|
||||||
echo -e "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Sensor Offline${idsCL[Default]}"
|
# echo -e "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Sensor Offline${idsCL[Default]}"
|
||||||
fi
|
# fi
|
||||||
fi
|
# fi
|
||||||
echo
|
echo
|
||||||
last_sensor=${SENSOR}
|
last_sensor=${SENSOR}
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user