Update powerwall.sh

This commit is contained in:
2022-09-08 21:43:59 -05:00
parent acd5b3b55a
commit 6adfa172a7

View File

@@ -61,7 +61,7 @@ CHECKTEMP_SERVICE(){
[ $temp_diff -lt 0 ] && temp_diff=$(($temp_diff * -1))
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 "alert sent"
last_temp=$temp_f
@@ -69,7 +69,7 @@ CHECKTEMP_SERVICE(){
echo "($datetime) WARNING: ${temp_f}°F - (Difference of ${temp_diff}°)"
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 "alert sent"
last_temp=$temp_f
@@ -137,7 +137,7 @@ if [ ${action-x} ]; then
update) UPDATE;;
checktemp) CHECKTEMP ${2};;
checktemp_service)
if [ "${2}" == "stop" ]; then
if [ "${2}" = "stop" ]; then
service_pid=`systemctl show --property MainPID --value ${SERVICE_NAME[${3}]}`
/bin/kill -9 $service_pid
/bin/systemctl stop $srvcname