diff --git a/mm-scripts.sh b/mm-scripts.sh index dbec060..c610b86 100755 --- a/mm-scripts.sh +++ b/mm-scripts.sh @@ -34,14 +34,23 @@ MMSTART(){ [ $VERBOSE = true ] && chktmstart=`date +%s` if [ "${1}" = "start" ] || [ "${1}" = "" ]; then GOFORSTART=true; + elif [ "${1}" = "check" ] && [ "$(ip link | grep "wg-torguard")" = "" ] && [ ! -f /opt/idssys/mediamanager/mm.vpn* ]; then GOFORSTART=true; [ "${EMAIL_NOTICE}" != "" ] && echo "" | mail -s "Starting Media Management Systems" ${EMAIL_NOTICE} echo "$(date) - Starting Media Management system - (wireguard not running)" >> $logfile echo -e "${idsCL[LightCyan]}Fresh startup${idsCL[Default]}" + + elif [ "${1}" = "check" ] && [ "$(ip link | grep "wg-torguard")" = "" ] && [ -f /opt/idssys/mediamanager/mm.vpn* ]; then + GOFORSTART=true; + [ "${EMAIL_NOTICE}" != "" ] && echo "" | mail -s "Starting Media Management Systems" ${EMAIL_NOTICE} + echo "$(date) - Attempting to restart systems after VPN failure..." >> $logfile + echo -e "${idsCL[LightCyan]}Attempting to restart systems after VPN failure...${idsCL[Default]}" else GOFORSTART=false; + fi + if [ ${GOFORSTART} = true ]; then mmsv='Starting' echo