Update mm-scripts.sh
This commit is contained in:
@@ -30,60 +30,39 @@ MMSTART(){
|
|||||||
echo
|
echo
|
||||||
echo -en "${idsCL[LightCyan]}Starting the VPN Tunnel ... ${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}Starting the VPN Tunnel ... ${idsCL[Default]}"
|
||||||
"${VPN_START[@]}"
|
"${VPN_START[@]}"
|
||||||
sleep 3s
|
sleep 5s
|
||||||
else
|
else
|
||||||
mmsv='Verifying'
|
mmsv='Verifying'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
checked=false
|
OUT=$(ip link | grep "$VPN_INTERFACE")
|
||||||
cc=0
|
if [ ${#OUT} = 0 ]; then
|
||||||
until [ "${checked}" = "" ]; do
|
if [ -f /opt/mm.vpn.fail ]; then
|
||||||
OUT=$(ip link | grep "$VPN_INTERFACE")
|
echo -e "${idsCL[Red]} failed, restarting system${idsCL[Default]}"
|
||||||
#OUT=`ip a show $VPN_INTERFACE up` >/dev/null 2>&1
|
echo "$(date) - VPN Failure #2 - restarting system" >> $logfile
|
||||||
if [ ${#OUT} -ne 0 ]; then
|
touch /opt/mm.vpn.fail2
|
||||||
checked=""
|
rm -f /opt/mm.vpn.fail
|
||||||
elif [ "${1}" = "check" ] && [ ${cc} -eq 0 ]; then
|
MMSTOP
|
||||||
|
sleep 5m
|
||||||
|
"${VPN_START[@]}"
|
||||||
|
rm -f /opt/mm.stop
|
||||||
|
exit 1
|
||||||
|
elif [ -f /opt/mm.vpn.fail2 ]; then
|
||||||
|
echo "$(date) - VPN Failure #3 - Shutting down Media Management systems" >> $logfile
|
||||||
|
MMSTOP
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo -e "${idsCL[Red]} failed, restarting system${idsCL[Default]}"
|
||||||
|
echo "$(date) - VPN Failure #1 - restarting system" >> $logfile
|
||||||
touch /opt/mm.vpn.fail
|
touch /opt/mm.vpn.fail
|
||||||
echo "$(date) - VPN Failure on 1st check" >> $logfile
|
|
||||||
MMSTOP
|
MMSTOP
|
||||||
sleep 1m
|
sleep 1m
|
||||||
"${VPN_START[@]}"
|
"${VPN_START[@]}"
|
||||||
rm -f /opt/mm.stop
|
rm -f /opt/mm.stop
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "${checked}" == "false" ] && [ ${cc} -eq 10 ]; then
|
|
||||||
if [ -f /opt/mm.vpn.fail ]; then
|
|
||||||
echo "$(date) - VPN Failure #2" >> $logfile
|
|
||||||
touch /opt/mm.vpn.fail2
|
|
||||||
rm -f /opt/mm.vpn.fail
|
|
||||||
MMSTOP
|
|
||||||
sleep 5m
|
|
||||||
"${VPN_START[@]}"
|
|
||||||
rm -f /opt/mm.stop
|
|
||||||
exit 1
|
|
||||||
elif [ -f /opt/mm.vpn.fail2 ]; then
|
|
||||||
echo "$(date) - VPN Failure #3 - Shutting down Media Management systems" >> $logfile
|
|
||||||
MMSTOP
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "$(date) - VPN Failure #1" >> $logfile
|
|
||||||
touch /opt/mm.vpn.fail
|
|
||||||
MMSTOP
|
|
||||||
sleep 1m
|
|
||||||
"${VPN_START[@]}"
|
|
||||||
rm -f /opt/mm.stop
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
((cc=${cc}+1))
|
else
|
||||||
sleep 1s
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
OUT=$(ip link | grep "$VPN_INTERFACE")
|
|
||||||
#OUT=`ip a show $VPN_INTERFACE up` >/dev/null 2>&1
|
|
||||||
if [ ${#OUT} -ne 0 ]; then
|
|
||||||
|
|
||||||
if [ "$(ip route show | grep 0.0.0.0 | cut -d' ' -f 3)" != "$(ip route show | grep default | cut -d' ' -f 3)" ]; then
|
if [ "$(ip route show | grep 0.0.0.0 | cut -d' ' -f 3)" != "$(ip route show | grep default | cut -d' ' -f 3)" ]; then
|
||||||
/bin/ip route del default via 10.10.0.1
|
/bin/ip route del default via 10.10.0.1
|
||||||
|
|||||||
Reference in New Issue
Block a user