Update mm-scripts.sh

This commit is contained in:
2022-12-31 16:53:41 -06:00
parent f2ecda0ef7
commit e73f3d60ab

View File

@@ -96,11 +96,13 @@ MMSTART(){
fi fi
else else
zerogw=$(ip route show | grep 0.0.0.0 | cut -d' ' -f 3)
defaultgw=$(ip route show | grep default | cut -d' ' -f 3)
if [ "$(ip route show | grep 0.0.0.0 | cut -d' ' -f 3)" != "$(ip route show | grep default | cut -d' ' -f 3)" ]; then if [ "${zerogw}" != "${defaultgw}" ]; then
[ $VERBOSE = true ] && echo "$(date) - Adding VPN default routes" >> $logfile [ $VERBOSE = true ] && echo "$(date) - Adding VPN default routes" >> $logfile
/bin/ip route del default via 10.10.0.1 /bin/ip route del default via 10.10.0.1
/bin/ip route add default via $(ip route show | grep 0.0.0.0 | cut -d' ' -f 3) /bin/ip route add default via ${zerogw}
fi fi
if [ ${GOFORSTART} = true ]; then if [ ${GOFORSTART} = true ]; then
@@ -111,8 +113,6 @@ MMSTART(){
checked=false checked=false
cc=0 cc=0
until [ "${checked}" = "" ]; do until [ "${checked}" = "" ]; do
zerogw=$(ip route show | grep 0.0.0.0 | cut -d' ' -f 3)
defaultgw=$(ip route show | grep default | cut -d' ' -f 3)
if [ "${zerogw}" = "${defaultgw}" ]; then if [ "${zerogw}" = "${defaultgw}" ]; then
checked="" checked=""
fi fi
@@ -131,6 +131,8 @@ MMSTART(){
fi fi
((cc=${cc}+1)) ((cc=${cc}+1))
sleep 1s sleep 1s
zerogw=$(ip route show | grep 0.0.0.0 | cut -d' ' -f 3)
defaultgw=$(ip route show | grep default | cut -d' ' -f 3)
done done
echo -e "${idsCL[Green]} done${idsCL[Default]}" echo -e "${idsCL[Green]} done${idsCL[Default]}"