Update powerwall.sh
This commit is contained in:
14
powerwall.sh
14
powerwall.sh
@@ -62,29 +62,29 @@ CHECKTEMP_SERVICE(){
|
|||||||
|
|
||||||
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
|
||||||
if [ $temp_diff -gt 1 ] || [ "$last_temp" == "1" ]; then
|
if [ $temp_diff -gt 1 ] || [ "$last_temp" == "1" ]; then
|
||||||
echo "($datetime) WARNING TEMP: $temp_f°F - (Difference of $temp_diff°)" | mail -s "${1} TEMP WARNING" $email_alert
|
echo "($datetime) WARNING TEMP: ${temp_f}°F - (Difference of ${temp_diff}°)" | mail -s "${1} TEMP WARNING" $email_alert
|
||||||
echo "alert sent"
|
echo "alert sent"
|
||||||
last_temp=$temp_f
|
last_temp=$temp_f
|
||||||
fi
|
fi
|
||||||
echo "($datetime) WARNING: $temp_f°F - (Difference of $temp_diff°)"
|
echo "($datetime) WARNING: ${temp_f}°F - (Difference of ${temp_diff}°)"
|
||||||
|
|
||||||
elif [ $(bc -l <<< "$temp_f >= $temp_crit") -eq 1 ]; then
|
elif [ $(bc -l <<< "$temp_f >= $temp_crit") -eq 1 ]; then
|
||||||
if [ $temp_diff -gt 1 ] || [ "$last_temp" == "1" ]; then
|
if [ $temp_diff -gt 1 ] || [ "$last_temp" == "1" ]; then
|
||||||
echo "($datetime) CRITICAL TEMP: $temp_f°F - (Difference of $temp_diff°)" | mail -s "${1} TEMP CRITICAL" $email_alert
|
echo "($datetime) CRITICAL TEMP: ${temp_f}°F - (Difference of ${temp_diff}°)" | mail -s "${1} TEMP CRITICAL" $email_alert
|
||||||
echo "alert sent"
|
echo "alert sent"
|
||||||
last_temp=$temp_f
|
last_temp=$temp_f
|
||||||
fi
|
fi
|
||||||
echo "($datetime) CRITICAL: $temp_f°F - (Difference of $temp_diff°)"
|
echo "($datetime) CRITICAL: ${temp_f}°F - (Difference of ${temp_diff}°)"
|
||||||
|
|
||||||
else
|
else
|
||||||
if [ $last_temp -gt 1 ]; then
|
if [ $last_temp -gt 1 ]; then
|
||||||
echo -e "($datetime) NORMAL TEMP: $temp_f°F\nPrevious Temp: $last_tempf°FF" | mail -s "${1} BACK TO NORMAL" $email_alert
|
echo -e "($datetime) NORMAL TEMP: ${temp_f}°F\nPrevious Temp: ${last_temp}°F" | mail -s "${1} BACK TO NORMAL" $email_alert
|
||||||
echo "alert sent"
|
echo "alert sent"
|
||||||
elif [ "$last_temp" = "0" ]; then
|
elif [ "$last_temp" = "0" ]; then
|
||||||
echo "NORMAL TEMP: $temp_f°F" | mail -s "${1} TEMP NORMAL" $email_alert;
|
echo "NORMAL TEMP: ${temp_f}°F" | mail -s "${1} TEMP NORMAL" $email_alert;
|
||||||
fi
|
fi
|
||||||
last_temp=1
|
last_temp=1
|
||||||
echo "($datetime) normal: $temp_f°F"
|
echo "($datetime) normal: ${temp_f}°F"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`, \`hum\`) VALUES ('${SENSOR_ID[$1]}','${datetime}','${temp_f}','${temp_h}')"
|
QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`, \`hum\`) VALUES ('${SENSOR_ID[$1]}','${datetime}','${temp_f}','${temp_h}')"
|
||||||
|
|||||||
Reference in New Issue
Block a user