This commit is contained in:
2023-03-18 22:16:40 -05:00
parent e4a0ce8b64
commit d1cea1cb2e
2 changed files with 12 additions and 8 deletions

View File

@@ -48,7 +48,11 @@ MMUPDATECHECK(){
} }
SENDNOTICE(){ SENDNOTICE(){
[ "${EMAIL_NOTICE}" != "" ] && echo -e "${2}\n\n$(date)" | mail -s "${1}" ${EMAIL_NOTICE} # [ "${EMAIL_NOTICE}" != "" ] && echo -e "${2}\n\n$(date)" | mail -s "${1}" ${EMAIL_NOTICE}
[ "${EMAIL_NOTICE}" != "" ] && push_to_mobile "${2}
$(date)" "${1}" ${3}
} }
uptime_minutes() { uptime_minutes() {

View File

@@ -110,7 +110,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
if [ -f ${MMFOLDER}/mm.vpn.fail ]; then if [ -f ${MMFOLDER}/mm.vpn.fail ]; then
echo -e "${idsCL[Red]} failed, restarting system${idsCL[Default]}" echo -e "${idsCL[Red]} failed, restarting system${idsCL[Default]}"
echo "$(date) - VPN Failure #2 - restarting system" >> $logfile echo "$(date) - VPN Failure #2 - restarting system" >> $logfile
SENDNOTICE "VPN Failure" "2nd Failure, will try and restart the VPN" SENDNOTICE "VPN Failure" "2nd Failure, will try and restart the VPN" 1
touch ${MMFOLDER}/mm.vpn.fail2 touch ${MMFOLDER}/mm.vpn.fail2
rm -f ${MMFOLDER}/mm.vpn.fail rm -f ${MMFOLDER}/mm.vpn.fail
MMSTOP MMSTOP
@@ -122,14 +122,14 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
exit 1 exit 1
elif [ -f ${MMFOLDER}/mm.vpn.fail2 ]; then elif [ -f ${MMFOLDER}/mm.vpn.fail2 ]; then
echo "$(date) - VPN Failure #3 - Shutting down Media Management systems" >> $logfile echo "$(date) - VPN Failure #3 - Shutting down Media Management systems" >> $logfile
SENDNOTICE "VPN Failure" "Final Failure, shutting down system" SENDNOTICE "VPN Failure" "Final Failure, shutting down system" 2
MMSTOP MMSTOP
[ $VERBOSE = true ] && DEBUGLOGSTOP [ $VERBOSE = true ] && DEBUGLOGSTOP
exit 1 exit 1
else else
echo -e "${idsCL[Red]} failed, restarting system${idsCL[Default]}" echo -e "${idsCL[Red]} failed, restarting system${idsCL[Default]}"
echo "$(date) - VPN Failure #1 - restarting system" >> $logfile echo "$(date) - VPN Failure #1 - restarting system" >> $logfile
SENDNOTICE "VPN Failure" "1st Failure, will try and restart the VPN" SENDNOTICE "VPN Failure" "1st Failure, will try and restart the VPN" 1
touch ${MMFOLDER}/mm.vpn.fail touch ${MMFOLDER}/mm.vpn.fail
MMSTOP MMSTOP
sleep 30s sleep 30s
@@ -174,7 +174,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
if [ "${checked}" == "false" ] && [ ${cc} -eq 10 ]; then if [ "${checked}" == "false" ] && [ ${cc} -eq 10 ]; then
echo -e "${idsCL[Red]}Could not confirm default routes, restarting system!${idsCL[Default]}" echo -e "${idsCL[Red]}Could not confirm default routes, restarting system!${idsCL[Default]}"
echo "$(date) - Could not confirm default routes, restarting system" >> $logfile echo "$(date) - Could not confirm default routes, restarting system" >> $logfile
SENDNOTICE "Network Failure" "Default route failure, will try and restart the VPN" SENDNOTICE "Network Failure" "Default route failure, will try and restart the VPN" 1
touch ${MMFOLDER}/mm.vpn.fail touch ${MMFOLDER}/mm.vpn.fail
MMSTOP MMSTOP
sleep 2m sleep 2m
@@ -204,7 +204,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
echo -e "${idsCL[Red]}Cannot get an WAN address, restarting system!${idsCL[Default]}" echo -e "${idsCL[Red]}Cannot get an WAN address, restarting system!${idsCL[Default]}"
echo "$(date) - Cannot get an WAN address, restarting system! scip(${scip}) mmip(${mmip})" >> $logfile echo "$(date) - Cannot get an WAN address, restarting system! scip(${scip}) mmip(${mmip})" >> $logfile
[ $VERBOSE = true ] && echo "$(date) - Default Routes: zerogw(${zerogw}) defaultgw(${defaultgw})" >> $logfile [ $VERBOSE = true ] && echo "$(date) - Default Routes: zerogw(${zerogw}) defaultgw(${defaultgw})" >> $logfile
SENDNOTICE "Network Failure" "Cannot get an WAN address, will try and restart the VPN" SENDNOTICE "Network Failure" "Cannot get an WAN address, will try and restart the VPN" 1
touch ${MMFOLDER}/mm.vpn.fail touch ${MMFOLDER}/mm.vpn.fail
MMSTOP MMSTOP
sleep 2m sleep 2m
@@ -224,7 +224,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
echo -e "${idsCL[Red]}Traffic is not routing through VPN, restarting system!${idsCL[Default]}" 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 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 [ $VERBOSE = true ] && echo "$(date) - Default Routes: zerogw(${zerogw}) defaultgw(${defaultgw})" >> $logfile
SENDNOTICE "Network Failure" "Traffic route failure, will try and restart the VPN" SENDNOTICE "Network Failure" "Traffic route failure, will try and restart the VPN" 1
touch ${MMFOLDER}/mm.vpn.fail touch ${MMFOLDER}/mm.vpn.fail
MMSTOP MMSTOP
sleep 2m sleep 2m
@@ -260,7 +260,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
fi fi
if [ "${EMAIL_NOTICE}" != "" ] && [ ${PMFS} = true ]; then if [ "${EMAIL_NOTICE}" != "" ] && [ ${PMFS} = true ]; then
SENDNOTICE "Plex Media Not Mounted" "Could not mount the Plex Media Folder" SENDNOTICE "Plex Media Not Mounted" "Could not mount the Plex Media Folder" 1
touch ${MMFOLDER}/mm.plexmount.fail touch ${MMFOLDER}/mm.plexmount.fail
echo "$(date) - Plex Media could not be mounted" >> $logfile echo "$(date) - Plex Media could not be mounted" >> $logfile
fi fi