From 79f5e7b8d7f075bfee2a6bd85ef1316ff5e53959 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 26 Jul 2022 18:20:29 -0500 Subject: [PATCH] fix vpn fixed notifications --- defaults.inc | 2 +- mm-scripts.sh | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/defaults.inc b/defaults.inc index ec445fc..47bc19d 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERS='1.07242022' +VERS='1.07262022' MMSRV=$(/sbin/ip -o -4 addr list ens160 | awk '{print $4}' | cut -d/ -f1) diff --git a/mm-scripts.sh b/mm-scripts.sh index 326f769..fa77908 100755 --- a/mm-scripts.sh +++ b/mm-scripts.sh @@ -3,7 +3,7 @@ action="$1" -VERBOSE=true +VERBOSE=false SENDNOTICE=true @@ -97,6 +97,7 @@ MMSTART(){ echo -e "${idsCL[Red]}Could not confirm default routes, restarting system!${idsCL[Default]}" echo "$(date) - Could not confirm default routes, restarting system" >> $logfile [ $SENDNOTICE = true ] && echo "Default route failure, will try and restart the VPN" | mail -s "Network Failure" 9208839613@mms.att.net + touch /opt/mm.vpn.fail MMSTOP sleep 2m "${VPN_START[@]}" & @@ -115,14 +116,15 @@ MMSTART(){ scip="" mmip="" cc=0 - until [ "${scip}" != "" ] && [ "${mmip}" != "" ]; do + until [ "${scip}" != "" ] && [ "${mmip}" != "" ] && [ "${scip}" != ";; connection timed out; no servers could be reached" ] && [ "${mmip}" != ";; connection timed out; no servers could be reached" ]; do scip=$(dig +short sc1.scity.us @ns1.scity.us) mmip=$(dig +short myip.opendns.com @resolver1.opendns.com) if ([ "${scip}" = "" ] || [ "${mmip}" = "" ]) && [ ${cc} -eq 10 ]; then echo -e "${idsCL[Red]}Cannot get an WAN address, restarting system!${idsCL[Default]}" - echo "$(date) - Cannot get an WAN address, restarting system scip(${scip}) mmip(${mmip})" >> $logfile + echo "$(date) - Cannot get an WAN address, restarting system! scip(${scip}) mmip(${mmip})" >> $logfile [ $VERBOSE = true ] && echo "$(date) - Default Routes: zerogw(${zerogw}) defaultgw(${defaultgw})" >> $logfile [ $SENDNOTICE = true ] && echo "Cannot get an WAN address, will try and restart the VPN" | mail -s "Network Failure" 9208839613@mms.att.net + touch /opt/mm.vpn.fail MMSTOP sleep 2m "${VPN_START[@]}" & @@ -138,9 +140,10 @@ MMSTART(){ [ $VERBOSE = true ] && echo "$(date) - WAN Address: ${mmip} - GW Address: ${defaultgw}" >> $logfile else echo -e "${idsCL[Red]}Traffic is not routing through VPN, restarting system!${idsCL[Default]}" - echo "$(date) - Traffic is not routing through VPN, restarting system scip(${scip}) mmip(${mmip})" >> $logfile + echo "$(date) - Traffic is not routing through VPN, restarting system! scip(${scip}) mmip(${mmip})" >> $logfile [ $VERBOSE = true ] && echo "$(date) - Default Routes: zerogw(${zerogw}) defaultgw(${defaultgw})" >> $logfile [ $SENDNOTICE = true ] && echo "Traffic route failure, will try and restart the VPN" | mail -s "Network Failure" 9208839613@mms.att.net + touch /opt/mm.vpn.fail MMSTOP sleep 2m "${VPN_START[@]}" &