Update mm-scripts.sh
This commit is contained in:
@@ -198,18 +198,19 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
|
|||||||
mmip=""
|
mmip=""
|
||||||
cc=0
|
cc=0
|
||||||
until [ "${scip}" != "" ] && [ "${mmip}" != "" ] && [ "${scip}" != ";; connection timed out; no servers could be reached" ] && [ "${mmip}" != ";; connection timed out; no servers could be reached" ]; 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 @10.10.10.5 -p 5053)
|
scip=$(dig +short +time=2 sc1.scity.us @10.10.10.5 -p 5053)
|
||||||
mmip=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
# mmip=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
||||||
if ([ "${scip}" = "" ] || [ "${mmip}" = "" ]) && [ ${cc} -eq 10 ]; then
|
mmip=$(dig +short +time=2 myip.opendns.com @208.67.222.222)
|
||||||
|
if [ ${cc} -eq 10 ]; then
|
||||||
echo -e "${idsCL[Red]}Cannot get an WAN address, restarting system!${idsCL[Default]}"
|
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
|
[ $VERBOSE = true ] && echo "$(date) - Default Routes: zerogw(${zerogw}) defaultgw(${defaultgw})" >> $logfile
|
||||||
SENDNOTICE "Network Failure" "Cannot get an WAN address, will try and restart the VPN" 1
|
SENDNOTICE "Network Failure" "Cannot get an WAN address, will try and restart the VPN" 1
|
||||||
touch ${MMFOLDER}/mm.vpn.fail
|
touch ${MMFOLDER}/mm.vpn.fail
|
||||||
MMSTOP
|
MMSTOP
|
||||||
sleep 2m
|
sleep 30s
|
||||||
"${VPN_START[@]}" >/dev/null 2>&1 &
|
"${VPN_START[@]}" >/dev/null 2>&1
|
||||||
sleep 1m
|
sleep 10s
|
||||||
rm -f ${MMFOLDER}/mm.stop*
|
rm -f ${MMFOLDER}/mm.stop*
|
||||||
[ $VERBOSE = true ] && DEBUGLOGSTOP
|
[ $VERBOSE = true ] && DEBUGLOGSTOP
|
||||||
exit 1
|
exit 1
|
||||||
@@ -227,9 +228,9 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
|
|||||||
SENDNOTICE "Network Failure" "Traffic route failure, will try and restart the VPN" 1
|
SENDNOTICE "Network Failure" "Traffic route failure, will try and restart the VPN" 1
|
||||||
touch ${MMFOLDER}/mm.vpn.fail
|
touch ${MMFOLDER}/mm.vpn.fail
|
||||||
MMSTOP
|
MMSTOP
|
||||||
sleep 2m
|
sleep 30s
|
||||||
"${VPN_START[@]}" >/dev/null 2>&1 &
|
"${VPN_START[@]}" >/dev/null 2>&1
|
||||||
sleep 1m
|
sleep 10s
|
||||||
rm -f ${MMFOLDER}/mm.stop*
|
rm -f ${MMFOLDER}/mm.stop*
|
||||||
[ $VERBOSE = true ] && DEBUGLOGSTOP
|
[ $VERBOSE = true ] && DEBUGLOGSTOP
|
||||||
exit 1
|
exit 1
|
||||||
@@ -435,7 +436,8 @@ MMSTATUS(){
|
|||||||
|
|
||||||
echo -en " |- Verify routing through VPN : "
|
echo -en " |- Verify routing through VPN : "
|
||||||
scip=$(dig +short sc1.scity.us @10.10.10.5 -p 5053)
|
scip=$(dig +short sc1.scity.us @10.10.10.5 -p 5053)
|
||||||
mmip=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
# mmip=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
||||||
|
mmip=$(dig +short myip.opendns.com @208.67.222.222)
|
||||||
if [ "${scip}" != "${mmip}" ]; then
|
if [ "${scip}" != "${mmip}" ]; then
|
||||||
echo -e "${idsCL[Green]}Good${idsCL[Default]}"
|
echo -e "${idsCL[Green]}Good${idsCL[Default]}"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user