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
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
/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
if [ ${GOFORSTART} = true ]; then
@@ -111,8 +113,6 @@ MMSTART(){
checked=false
cc=0
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
checked=""
fi
@@ -131,6 +131,8 @@ MMSTART(){
fi
((cc=${cc}+1))
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
echo -e "${idsCL[Green]} done${idsCL[Default]}"