From c6aa6736273248293d7aaa2a0859e882be9f843e Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 22 Apr 2023 22:57:50 -0500 Subject: [PATCH] Update mm-scripts.sh --- mm-scripts.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/mm-scripts.sh b/mm-scripts.sh index 9d7eddc..302e6a4 100755 --- a/mm-scripts.sh +++ b/mm-scripts.sh @@ -148,9 +148,13 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf sleep 5m "${VPN_START[@]}" >/dev/null 2>&1 sleep 10s - # rm -f ${MMFOLDER}/mm.stop* - # [ $VERBOSE = true ] && DEBUGLOGSTOP - # exit 1 + OUT=$(/sbin/ip link | grep "$VPN_INTERFACE") + if [ ${#OUT} = 0 ]; then + echo "$(date) - VPN Failure #2 - could not start system" >> $logfile + rm -f ${MMFOLDER}/mm.stop* + [ $VERBOSE = true ] && DEBUGLOGSTOP + exit 1 + fi elif [ -f ${MMFOLDER}/mm.vpn.fail2 ]; then echo "$(date) - VPN Failure #3 - Shutting down Media Management systems" >> $logfile SENDNOTICE "VPN Failure" "Final Failure, shutting down system" 2 @@ -166,12 +170,18 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf sleep 10s "${VPN_START[@]}" >/dev/null 2>&1 sleep 10s - # rm -f ${MMFOLDER}/mm.stop* - # [ $VERBOSE = true ] && DEBUGLOGSTOP - # exit 1 + OUT=$(/sbin/ip link | grep "$VPN_INTERFACE") + if [ ${#OUT} = 0 ]; then + echo "$(date) - VPN Failure #1 - could not start vpn" >> $logfile + rm -f ${MMFOLDER}/mm.stop* + [ $VERBOSE = true ] && DEBUGLOGSTOP + exit 1 + fi fi + fi - else + OUT=$(/sbin/ip link | grep "$VPN_INTERFACE") + if [ ${#OUT} != 0 ]; then if [ ${GOFORSTART} = true ] || [ "${1}" == "check" ]; then echo -e "${idsCL[Green]}Done${idsCL[Default]}" fi