Update mm-scripts.sh

This commit is contained in:
2023-03-22 19:05:56 -05:00
parent 1b04e38741
commit 8a74adc651

View File

@@ -198,18 +198,19 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
mmip=""
cc=0
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)
mmip=$(dig +short myip.opendns.com @resolver1.opendns.com)
if ([ "${scip}" = "" ] || [ "${mmip}" = "" ]) && [ ${cc} -eq 10 ]; then
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 +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 "$(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 "Network Failure" "Cannot get an WAN address, will try and restart the VPN" 1
touch ${MMFOLDER}/mm.vpn.fail
MMSTOP
sleep 2m
"${VPN_START[@]}" >/dev/null 2>&1 &
sleep 1m
sleep 30s
"${VPN_START[@]}" >/dev/null 2>&1
sleep 10s
rm -f ${MMFOLDER}/mm.stop*
[ $VERBOSE = true ] && DEBUGLOGSTOP
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
touch ${MMFOLDER}/mm.vpn.fail
MMSTOP
sleep 2m
"${VPN_START[@]}" >/dev/null 2>&1 &
sleep 1m
sleep 30s
"${VPN_START[@]}" >/dev/null 2>&1
sleep 10s
rm -f ${MMFOLDER}/mm.stop*
[ $VERBOSE = true ] && DEBUGLOGSTOP
exit 1
@@ -435,7 +436,8 @@ MMSTATUS(){
echo -en " |- Verify routing through VPN : "
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
echo -e "${idsCL[Green]}Good${idsCL[Default]}"
else