From db008e4537f9cbb81917a2779b2ed197522cb1c9 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 11 Sep 2022 15:35:04 -0500 Subject: [PATCH] Update powerwall.sh --- powerwall.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/powerwall.sh b/powerwall.sh index 8a8e9ae2..f94918a4 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -11,6 +11,8 @@ source /opt/idssys/defaults/default.inc shopt -s lastpipe +VERBOSE=false + #ssh root@10.5.10.35 '/vmfs/volumes/NFS_ESXi-Vault/esxi-shutdown.sh > /dev/null 2>&1' & > /dev/null 2>&1 @@ -118,20 +120,20 @@ CHECKACV_SERVICE(){ datetime=`date +'%Y-%m-%d %H:%M:%S'` if [ ${INPUTACV} -ge ${min_volt} ]; then if [ $voltstatus -eq 3 ]; then - echo "($datetime) back to normal voltage: ${INPUTACV}V" + [ $VERBOSE = true ] && echo "($datetime) back to normal voltage: ${INPUTACV}V" echo -e "($datetime) Normal voltage detected\nVOLTAGE: ${INPUTACV}V" | mail -s "POWER NOMINAL AGAIN" $email_alert - echo "alert sent" + [ $VERBOSE = true ] && echo "alert sent" elif [ $voltstatus -eq 0 ]; then - echo "($datetime) normal voltage: ${INPUTACV}V" + [ $VERBOSE = true ] && echo "($datetime) normal voltage: ${INPUTACV}V" echo -e "($datetime) Normal voltage detected\nVOLTAGE: ${INPUTACV}V" | mail -s "Power Nominal" $email_alert - echo "alert sent" + [ $VERBOSE = true ] && echo "alert sent" fi voltstatus=1 else echo "($datetime) LOW voltage: ${INPUTACV}V" if [ $voltstatus -lt 3 ]; then echo -e "($datetime) Power off or low voltage detected\nVOLTAGE: ${INPUTACV}V" | mail -s "POWER ALERT - LOW POWER!!" $email_alert - echo "alert sent" + [ $VERBOSE = true ] && echo "alert sent" fi voltstatus=3 fi