diff --git a/powerwall.sh b/powerwall.sh index d750b2fa..7118c4fe 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -63,6 +63,7 @@ CHECKTEMP_SERVICE(){ 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" == "0" ]; then echo "($datetime) WARNING TEMP: $temp_f°F - (Difference of $temp_diff°)" | mail -s "${1} TEMP WARNING" $email_alert + echo "alert sent" last_temp=$temp_f fi echo "($datetime) WARNING: $temp_f°F - (Difference of $temp_diff°)" @@ -70,6 +71,7 @@ CHECKTEMP_SERVICE(){ elif [ $(bc -l <<< "$temp_f >= $temp_crit") -eq 1 ]; then if [ $temp_diff -gt 1 ] || [ "$last_temp" == "0" ]; then echo "($datetime) CRITICAL TEMP: $temp_f°F - (Difference of $temp_diff°)" | mail -s "${1} TEMP CRITICAL" $email_alert + echo "alert sent" last_temp=$temp_f fi echo "($datetime) CRITICAL: $temp_f°F - (Difference of $temp_diff°)" @@ -77,6 +79,7 @@ CHECKTEMP_SERVICE(){ else if [ "$last_temp" != "1" ]; then echo "($datetime) NORMAL TEMP: $temp_f°F" | mail -s "${1} BACK TO NORMAL" $email_alert + echo "alert sent" last_temp=1 fi # echo "NORMAL TEMP: $temp_f°F" | mail -s "${1} TEMP NORMAL" $email_alert @@ -87,6 +90,7 @@ CHECKTEMP_SERVICE(){ ${mysql_conn} -e "${QRY}" else echo "($datetime) ERROR reading temperature" | mail -s "${1} ERROR" $email_alert + echo "alert sent" fi done sleep 10