Update powerwall.sh
This commit is contained in:
@@ -61,7 +61,7 @@ CHECKTEMP_SERVICE(){
|
|||||||
[ $temp_diff -lt 0 ] && temp_diff=$(($temp_diff * -1))
|
[ $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 [ $(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
|
||||||
@@ -69,7 +69,7 @@ CHECKTEMP_SERVICE(){
|
|||||||
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
|
||||||
@@ -137,7 +137,7 @@ if [ ${action-x} ]; then
|
|||||||
update) UPDATE;;
|
update) UPDATE;;
|
||||||
checktemp) CHECKTEMP ${2};;
|
checktemp) CHECKTEMP ${2};;
|
||||||
checktemp_service)
|
checktemp_service)
|
||||||
if [ "${2}" == "stop" ]; then
|
if [ "${2}" = "stop" ]; then
|
||||||
service_pid=`systemctl show --property MainPID --value ${SERVICE_NAME[${3}]}`
|
service_pid=`systemctl show --property MainPID --value ${SERVICE_NAME[${3}]}`
|
||||||
/bin/kill -9 $service_pid
|
/bin/kill -9 $service_pid
|
||||||
/bin/systemctl stop $srvcname
|
/bin/systemctl stop $srvcname
|
||||||
|
|||||||
Reference in New Issue
Block a user