Update powerwall.sh

This commit is contained in:
2023-12-03 18:27:38 -06:00
parent 459f31f99c
commit 1920aff2e0

View File

@@ -321,9 +321,9 @@ CHECKTEMP_SERVICE(){
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} - Sensor is reporting data again" >> ${logtemp}
rm -f ${PW_TMPFOLDER}/${SENSOR}-error.reading
fi
temp_f=$(echo "scale=2; ${temp_c}*1.8 + 32" | bc)
# echo "HERE: ${SENSOR} - ${temp_f} - ${temp_warn} - ${temp_crit} - ${temp_crit_sys}"
fi
[ "${PW_SENSOR_TYPE[${SENSOR}]}" == "cpu" ] && temp_f=$(echo "scale=2; $temp_c/1" | bc -l) || temp_f=$(echo "scale=2; ${temp_c}*1.8 + 32" | bc)
echo "HERE: ${SENSOR} - ${temp_f} - ${temp_warn} - ${temp_crit} - ${temp_crit_sys}"
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" != "esxi" ]; then
echo ${PW_TEMP_THRESHOLDS[${SENSOR}]} | cut -d',' -f 1 | read temp_warn
@@ -358,8 +358,7 @@ CHECKTEMP_SERVICE(){
elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit_sys}") -eq 1 ]; then
touch ${PW_TMPFOLDER}/temp.crit
if [ $(bc -l <<< "${temp_diff} > 1") -eq 1 ] || [ "${last_temp[${SENSOR}]}" = "1" ]; then
SENDNOTICE "${SENSOR} TEMP CRITICAL" "CRITICAL TEMP: ${temp_f}'F - (Difference of ${temp_diff}')
Shutting down servers!!" 1
SENDNOTICE "${SENSOR} TEMP CRITICAL" "CRITICAL TEMP: ${temp_f}'F - (Difference of ${temp_diff}')" 1
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}'F - CRITICAL - (Difference of ${temp_diff}'F)" >> ${logtemp}
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} - ${temp_f}'F - CRITICAL TEMP - (Difference of ${temp_diff}')" >> ${PW_LOGFILE}
last_temp[${SENSOR}]=${temp_f}