Update mm-scripts.sh

This commit is contained in:
2022-06-14 17:33:15 -05:00
parent d91daf249f
commit a5ebc21c52

View File

@@ -29,7 +29,7 @@ unset IFS
MMSTART(){ MMSTART(){
[ $VERBOSE = true ] && chktmstart=`date +%s` [ $VERBOSE = true ] && chktmstart=`date +%s`
if [ "${1}" = "start" ]; then if [ "${1}" = "start" ] || [ "${1}" = "" ]; then
mmsv='Starting' mmsv='Starting'
echo echo
echo -en "${idsCL[LightCyan]}Starting the VPN Tunnel ... ${idsCL[Default]}" echo -en "${idsCL[LightCyan]}Starting the VPN Tunnel ... ${idsCL[Default]}"
@@ -52,7 +52,7 @@ MMSTART(){
rm -f /opt/mm.vpn.fail rm -f /opt/mm.vpn.fail
MMSTOP MMSTOP
sleep 5m sleep 5m
"${VPN_START[@]}" "${VPN_START[@]}" &
sleep 1m sleep 1m
rm -f /opt/mm.stop rm -f /opt/mm.stop
exit 1 exit 1
@@ -68,7 +68,7 @@ MMSTART(){
touch /opt/mm.vpn.fail touch /opt/mm.vpn.fail
MMSTOP MMSTOP
sleep 1m sleep 1m
"${VPN_START[@]}" "${VPN_START[@]}" &
sleep 1m sleep 1m
rm -f /opt/mm.stop rm -f /opt/mm.stop
exit 1 exit 1
@@ -99,7 +99,7 @@ MMSTART(){
[ $SENDNOTICE = true ] && echo "Default route failure, will try and restart the VPN" | mail -s "Network Failure" 9208839613@mms.att.net [ $SENDNOTICE = true ] && echo "Default route failure, will try and restart the VPN" | mail -s "Network Failure" 9208839613@mms.att.net
MMSTOP MMSTOP
sleep 2m sleep 2m
"${VPN_START[@]}" "${VPN_START[@]}" &
sleep 1m sleep 1m
rm -f /opt/mm.stop rm -f /opt/mm.stop
exit 1 exit 1
@@ -125,7 +125,7 @@ MMSTART(){
[ $SENDNOTICE = true ] && echo "Cannot get an WAN address, will try and restart the VPN" | mail -s "Network Failure" 9208839613@mms.att.net [ $SENDNOTICE = true ] && echo "Cannot get an WAN address, will try and restart the VPN" | mail -s "Network Failure" 9208839613@mms.att.net
MMSTOP MMSTOP
sleep 2m sleep 2m
"${VPN_START[@]}" "${VPN_START[@]}" &
sleep 1m sleep 1m
rm -f /opt/mm.stop rm -f /opt/mm.stop
exit 1 exit 1
@@ -143,7 +143,7 @@ MMSTART(){
[ $SENDNOTICE = true ] && echo "Traffic route failure, will try and restart the VPN" | mail -s "Network Failure" 9208839613@mms.att.net [ $SENDNOTICE = true ] && echo "Traffic route failure, will try and restart the VPN" | mail -s "Network Failure" 9208839613@mms.att.net
MMSTOP MMSTOP
sleep 2m sleep 2m
"${VPN_START[@]}" "${VPN_START[@]}" &
sleep 1m sleep 1m
rm -f /opt/mm.stop rm -f /opt/mm.stop
exit 1 exit 1
@@ -159,15 +159,19 @@ MMSTART(){
echo -e "${idsCL[LightCyan]}It may take a couple of minutes before all services fully start${idsCL[Default]}" echo -e "${idsCL[LightCyan]}It may take a couple of minutes before all services fully start${idsCL[Default]}"
echo echo
fi fi
if [ "${1}" == "start" ] || [ -f /opt/mm.vpn.fail* ]; then if [ -f /opt/mm.vpn.fail* ]; then
echo "$(date) - Media services have been restarted" >> $logfile echo "$(date) - VPN issue has been fixed" >> $logfile
elif [ "${1}" != "start" ] && [ -f /opt/mm.vpn.fail* ]; then if [ "${1}" == "check" ]; then
[ $SENDNOTICE = true ] && echo "Media services have been restarted" | mail -s "Services Restored" 9208839613@mms.att.net [ $SENDNOTICE = true ] && echo "VPN issue has been fixed" | mail -s "Services Restored" 9208839613@mms.att.net
fi
rm -f /opt/mm.vpn.fail*
fi fi
rm -f /opt/mm.stop rm -f /opt/mm.stop
rm -f /opt/mm.vpn.fail*
echo echo
echo -e "${idsCL[Green]}All services have been started${idsCL[Default]}" echo -e "${idsCL[Green]}All services have been started${idsCL[Default]}"
if [ "${1}" = "start" ] || [ "${1}" = "" ]; then
[ $VERBOSE = true ] && echo "$(date) - All services started" >> $logfile
fi
fi fi
echo echo
@@ -285,7 +289,7 @@ MMSTATUS(){
echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}" echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}"
MMSTOP MMSTOP
sleep 30s sleep 30s
MMSTART start MMSTART
fi fi
echo -en " |- Verify traffic route to VPN -> : " echo -en " |- Verify traffic route to VPN -> : "
@@ -299,7 +303,7 @@ MMSTATUS(){
echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}" echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}"
MMSTOP MMSTOP
sleep 30s sleep 30s
MMSTART start MMSTART
fi fi
echo echo
@@ -335,7 +339,7 @@ if [ ! -f /opt/mm.update.stop ]; then
fi fi
MMSTOP MMSTOP
sleep 10s sleep 10s
MMSTART start;; MMSTART;;
status) status)
if [ -f /opt/mm.stop ]; then if [ -f /opt/mm.stop ]; then