diff --git a/defaults.inc b/defaults.inc index ccd9c08a..f2bde415 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERS='5.1.105-04242024' +VERS='5.1.106-04242024' NM_BETA=false noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck update-dyndns backup-offsitepfsense gui nightlyreview update log betacheck offsite-staticroute-fix ' diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index cd2588a4..37753472 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -26,10 +26,26 @@ fi OFFSITE_STATICROUTE_FIX(){ if [ "$(CHECK_HOST 10.10.0.1)" != "true" ]; then - if [ "$(CHECK_HOST ${NM_OFFSITE_GW_IP})" != "false" ] && [ "$(CHECK_HOST 10.5.0.1)" != "false" ] && [ "$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_OFFSITE_GW_IP} ip r | grep 10.10.0.0)" = "" ]; then - RUN=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_OFFSITE_GW_IP} ip r add 10.10.0.0/16 dev wgsts1000) - SENDNOTICE "Static Route to Homesite Missing" "Re-added the static route onto the UniFi Gateway" + if [ "$(CHECK_HOST ${NM_OFFSITE_GW_IP})" != "false" ]; then + if [ "$(CHECK_HOST 10.5.0.1)" != "false" ]; then + if [ "$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_OFFSITE_GW_IP} ip r | grep 10.10.0.0)" = "" ]; then + RUN=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_OFFSITE_GW_IP} ip r add 10.10.0.0/16 dev wgsts1000 2>&1 >/dev/null) + if [ "${RUN}" == "" ]; then + SENDNOTICE "Static Route to Homesite Missing" "Re-added the static route onto the Offsite UniFi Gateway" + else + SENDNOTICE "ERROR: Static Route to Homesite Missing" "Cannot add the static route onto the Offsite UniFi Gateway" 1 + fi + fi + else + if [ ! -f ${NM_TMPFOLDER}/vpn-tunnel.down ]; then + touch ${NM_TMPFOLDER}/vpn-tunnel.down + elif [ $(expr `date +%s` - $(stat -c %Y ${NM_TMPFOLDER}/vpn-tunnel.down)) -ge 300 ]; then + SENDNOTICE "VPN to Homesite Down" "FiX'yO ShiTTy A$$ VPN" + fi + fi fi + else + rm -f ${NM_TMPFOLDER}/vpn-tunnel* fi }