From 24c22d907e11bd9a3e4f708ddf68250789e4b23f Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 5 Jun 2022 12:29:01 -0500 Subject: [PATCH] Update mm-scripts.sh --- mm-scripts.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm-scripts.sh b/mm-scripts.sh index e5058a5..0523978 100755 --- a/mm-scripts.sh +++ b/mm-scripts.sh @@ -4,6 +4,7 @@ action="$1" VERBOSE=true +SENDNOTICE=true source /opt/idssys/defaults/colors.inc @@ -45,6 +46,7 @@ MMSTART(){ if [ -f /opt/mm.vpn.fail ]; then echo -e "${idsCL[Red]} failed, restarting system${idsCL[Default]}" echo "$(date) - VPN Failure #2 - restarting system" >> $logfile + [ $SENDNOTICE = true ] && echo "2nd Failure, will try and restart the VPN" | mail -s "VPN Failure" 9208839613@mms.att.net touch /opt/mm.vpn.fail2 rm -f /opt/mm.vpn.fail MMSTOP @@ -55,11 +57,13 @@ MMSTART(){ exit 1 elif [ -f /opt/mm.vpn.fail2 ]; then echo "$(date) - VPN Failure #3 - Shutting down Media Management systems" >> $logfile + [ $SENDNOTICE = true ] && echo "Final Failure, shutting down system" | mail -s "VPN Failure" 9208839613@mms.att.net MMSTOP exit 1 else echo -e "${idsCL[Red]} failed, restarting system${idsCL[Default]}" echo "$(date) - VPN Failure #1 - restarting system" >> $logfile + [ $SENDNOTICE = true ] && echo "1st Failure, will try and restart the VPN" | mail -s "VPN Failure" 9208839613@mms.att.net touch /opt/mm.vpn.fail MMSTOP sleep 1m @@ -91,6 +95,7 @@ MMSTART(){ if [ "${checked}" == "false" ] && [ ${cc} -eq 10 ]; then echo -e "${idsCL[Red]}Could not confirm default routes, restarting system!${idsCL[Default]}" echo "$(date) - Could not confirm default routes, restarting system" >> $logfile + [ $SENDNOTICE = true ] && echo "Default route failure, will try and restart the VPN" | mail -s "Network Failure" 9208839613@mms.att.net MMSTOP sleep 1m "${VPN_START[@]}" @@ -113,6 +118,7 @@ MMSTART(){ echo -e "${idsCL[Red]}Traffic is not routing through VPN, restarting system!${idsCL[Default]}" echo "$(date) - Traffic is not routing through VPN, restarting system scip(${scip}) mmip(${mmip})" >> $logfile [ $VERBOSE = true ] && echo "$(date) - Default Routes: zerogw(${zerogw}) defaultgw(${defaultgw})" >> $logfile + [ $SENDNOTICE = true ] && echo "Traffic route failure, will try and restart the VPN" | mail -s "Network Failure" 9208839613@mms.att.net MMSTOP sleep 1m "${VPN_START[@]}"