Update powerwall.sh
This commit is contained in:
15
powerwall.sh
15
powerwall.sh
@@ -110,6 +110,7 @@ CHECKTEMP(){
|
|||||||
CHECKTEMPSENSOR(){
|
CHECKTEMPSENSOR(){
|
||||||
echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
|
echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
|
||||||
echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit
|
echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit
|
||||||
|
[ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ] && GAUGESH="'%" || GAUGESH="'F"
|
||||||
|
|
||||||
if [ "${6}" != "noavg" ]; then
|
if [ "${6}" != "noavg" ]; then
|
||||||
[ "${6}" != "" ] && [[ "${6}" =~ ^[0-9]+$ ]] && avgdays=${6} || avgdays=3
|
[ "${6}" != "" ] && [[ "${6}" =~ ^[0-9]+$ ]] && avgdays=${6} || avgdays=3
|
||||||
@@ -170,24 +171,18 @@ CHECKTEMPSENSOR(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then
|
if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then
|
||||||
[ "${average}" != "" ] && echo -en "${idsCL[Yellow]}WARNING ${spct}${temp_f}'F /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Yellow]}WARNING ${spct}${temp_f}"
|
[ "${average}" != "" ] && echo -en "${idsCL[Yellow]}WARNING ${spct}${temp_f}${GAUGESH} /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Yellow]}WARNING ${spct}${temp_f}${GAUGESH}${idsCL[Default]}"
|
||||||
elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ]; then
|
elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ]; then
|
||||||
[ "${average}" != "" ] && echo -en "${idsCL[Red]}CRITICAL${spct}${temp_f}'F /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Red]}CRITICAL${spct}${temp_f}"
|
[ "${average}" != "" ] && echo -en "${idsCL[Red]}CRITICAL${spct}${temp_f}${GAUGESH} /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Red]}CRITICAL${spct}${temp_f}${GAUGESH}${idsCL[Default]}"
|
||||||
else
|
else
|
||||||
[ "${average}" != "" ] && echo -en "${idsCL[Green]}Normal ${spct}${temp_f}'F /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Green]}Normal ${spct}${temp_f}"
|
[ "${average}" != "" ] && echo -en "${idsCL[Green]}Normal ${spct}${temp_f}${GAUGESH} /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Green]}Normal ${spct}${temp_f}${GAUGESH}${idsCL[Default]}"
|
||||||
fi
|
fi
|
||||||
[ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ] && echo -en "%${idsCL[Default]}" || echo -en "'F${idsCL[Default]}"
|
|
||||||
|
|
||||||
tmp="${spct}${temp_f}"
|
tmp="${spct}${temp_f}"
|
||||||
c=0; spc=''; spc1=`expr 10 - ${#tmp}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
|
c=0; spc=''; spc1=`expr 10 - ${#tmp}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
|
||||||
[ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' '
|
[ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' '
|
||||||
[ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' '
|
[ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' '
|
||||||
if [ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ]; then
|
echo -e "${spc}[${spcw}${idsCL[Yellow]}${temp_warn}${GAUGESH}${idsCL[Default]} /${spcc}${idsCL[Red]}${temp_crit}${GAUGESH}=>${idsCL[Default]} ]"
|
||||||
echo -e "${spc} [${spcw} ${idsCL[Yellow]}${temp_warn}%${idsCL[Default]} /${spcc} ${idsCL[Red]}${temp_crit}%=>${idsCL[Default]} ]"
|
|
||||||
|
|
||||||
else
|
|
||||||
echo -e "${spc}[${spcw}${idsCL[Yellow]}${temp_warn}'F${idsCL[Default]} /${spcc}${idsCL[Red]}${temp_crit}'F=>${idsCL[Default]} ]"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
AVERAGETEMP(){
|
AVERAGETEMP(){
|
||||||
|
|||||||
Reference in New Issue
Block a user