fix vpn fixed notifications
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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[@]}" &
|
||||
|
||||
Reference in New Issue
Block a user