Update mm-scripts.sh
This commit is contained in:
@@ -97,7 +97,7 @@ MMSTART(){
|
|||||||
echo "$(date) - Could not confirm default routes, restarting system" >> $logfile
|
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
|
[ $SENDNOTICE = true ] && echo "Default route failure, will try and restart the VPN" | mail -s "Network Failure" 9208839613@mms.att.net
|
||||||
MMSTOP
|
MMSTOP
|
||||||
sleep 1m
|
sleep 2m
|
||||||
"${VPN_START[@]}"
|
"${VPN_START[@]}"
|
||||||
sleep 1m
|
sleep 1m
|
||||||
rm -f /opt/mm.stop
|
rm -f /opt/mm.stop
|
||||||
@@ -110,8 +110,27 @@ MMSTART(){
|
|||||||
|
|
||||||
|
|
||||||
echo -en "${idsCL[LightCyan]}Verifing traffic is routing through VPN... ${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}Verifing traffic is routing through VPN... ${idsCL[Default]}"
|
||||||
scip=$(dig +short sc1.scity.us @ns1.scity.us)
|
|
||||||
mmip=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
scip=""
|
||||||
|
mmip=""
|
||||||
|
cc=0
|
||||||
|
until [ "${scip}" != "" ] && [ "${mmip}" != "" ]; 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
|
||||||
|
[ $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
|
||||||
|
MMSTOP
|
||||||
|
sleep 2m
|
||||||
|
"${VPN_START[@]}"
|
||||||
|
sleep 1m
|
||||||
|
rm -f /opt/mm.stop
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 1s
|
||||||
|
done
|
||||||
if [ "${scip}" != "${mmip}" ]; then
|
if [ "${scip}" != "${mmip}" ]; then
|
||||||
echo -e "${idsCL[Green]} done${idsCL[Default]}"
|
echo -e "${idsCL[Green]} done${idsCL[Default]}"
|
||||||
else
|
else
|
||||||
@@ -120,7 +139,7 @@ MMSTART(){
|
|||||||
[ $VERBOSE = true ] && echo "$(date) - Default Routes: zerogw(${zerogw}) defaultgw(${defaultgw})" >> $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
|
[ $SENDNOTICE = true ] && echo "Traffic route failure, will try and restart the VPN" | mail -s "Network Failure" 9208839613@mms.att.net
|
||||||
MMSTOP
|
MMSTOP
|
||||||
sleep 1m
|
sleep 2m
|
||||||
"${VPN_START[@]}"
|
"${VPN_START[@]}"
|
||||||
sleep 1m
|
sleep 1m
|
||||||
rm -f /opt/mm.stop
|
rm -f /opt/mm.stop
|
||||||
@@ -250,7 +269,7 @@ MMSTATUS(){
|
|||||||
echo
|
echo
|
||||||
echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}"
|
echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}"
|
||||||
MMSTOP
|
MMSTOP
|
||||||
sleep 10s
|
sleep 30s
|
||||||
MMSTART start
|
MMSTART start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -264,7 +283,7 @@ MMSTATUS(){
|
|||||||
echo
|
echo
|
||||||
echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}"
|
echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}"
|
||||||
MMSTOP
|
MMSTOP
|
||||||
sleep 10s
|
sleep 30s
|
||||||
MMSTART start
|
MMSTART start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user