Update nodemgmt-scripts.sh

This commit is contained in:
2024-08-05 20:26:11 -05:00
parent f0560cad4c
commit d33d53746f

View File

@@ -25,39 +25,37 @@ fi
[ -f ${NM_BACKUP_FOLDER}/templates/*.config ] && rm -f ${NM_BACKUP_FOLDER}/templates/*.config [ -f ${NM_BACKUP_FOLDER}/templates/*.config ] && rm -f ${NM_BACKUP_FOLDER}/templates/*.config
OFFSITE_STATICROUTE_FIX(){ OFFSITE_STATICROUTE_FIX(){
# [ -f ${NM_TMPFOLDER}/vpn-tunnel.down.sent ] && [ "$(CHECK_HOST_QC 10.5.0.1)" != "true" ] && exit STSVPN_ADAPTER=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_OFFSITE_GW_IP} ip r | grep '10.5.0.0/20' | awk '{print $7}')
echo "'${STSVPN_ADAPTER}'"
CHECK_HOST_QC 10.10.0.1
CHECK_HOST_QC ${NM_OFFSITE_GW_IP}
CHECK_HOST_QC 10.5.0.1
# if [ "$(CHECK_HOST_QC 10.10.0.1)" != "true" ]; then if [ "$(CHECK_HOST_QC 10.10.0.1)" != "true" ]; then
# if [ "$(CHECK_HOST_QC ${NM_OFFSITE_GW_IP})" != "false" ]; then if [ "$(CHECK_HOST_QC ${NM_OFFSITE_GW_IP})" != "false" ]; then
# if [ "$(CHECK_HOST_QC 10.5.0.1)" != "false" ]; then if [ "$(CHECK_HOST_QC 10.5.0.1)" != "false" ]; then
# STSVPN_ADAPTER=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_OFFSITE_GW_IP} ip r | grep '10.5.0.0/20' | awk '{print $7}')
# if [ "$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_OFFSITE_GW_IP} ip r | grep 10.10.0.0)" = "" ]; 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 ${NM_OFFSITE_VPN_ADAPTER} 2>&1 >/dev/null) RUN=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_OFFSITE_GW_IP} ip r add 10.10.0.0/16 dev ${NM_OFFSITE_VPN_ADAPTER} 2>&1 >/dev/null)
# if [ "${RUN}" == "" ]; then if [ "${RUN}" == "" ]; then
# SENDNOTICE "Static Route to Homesite Missing" "Re-added the static route onto the Offsite UniFi Gateway" SENDNOTICE "Static Route to Homesite Missing" "Re-added the static route onto the Offsite UniFi Gateway"
# else else
# SENDNOTICE "ERROR: Static Route to Homesite Missing" "Cannot add the static route onto the Offsite UniFi Gateway" 1 SENDNOTICE "ERROR: Static Route to Homesite Missing" "Cannot add the static route onto the Offsite UniFi Gateway" 1
# fi fi
# fi fi
# else else
# if [ ! -f ${NM_TMPFOLDER}/vpn-tunnel.down ]; then if [ ! -f ${NM_TMPFOLDER}/vpn-tunnel.down ]; then
# touch ${NM_TMPFOLDER}/vpn-tunnel.down touch ${NM_TMPFOLDER}/vpn-tunnel.down
# elif [ $(expr `date +%s` - $(stat -c %Y ${NM_TMPFOLDER}/vpn-tunnel.down)) -ge 60 ] && [ ! -f ${NM_TMPFOLDER}/vpn-tunnel.down.sent ]; then elif [ $(expr `date +%s` - $(stat -c %Y ${NM_TMPFOLDER}/vpn-tunnel.down)) -ge 60 ] && [ ! -f ${NM_TMPFOLDER}/vpn-tunnel.down.sent ]; then
# SENDNOTICE "VPN to Homesite Down" "VPN is down, fix your shit first, then I'll fix mine..." SENDNOTICE "VPN to Homesite Down" "VPN is down, fix your shit first, then I'll fix mine..."
# touch ${NM_TMPFOLDER}/vpn-tunnel.down.sent touch ${NM_TMPFOLDER}/vpn-tunnel.down.sent
# fi fi
# fi fi
# fi fi
# else else
# if [ -f ${NM_TMPFOLDER}/vpn-tunnel.down ]; then if [ -f ${NM_TMPFOLDER}/vpn-tunnel.down ]; then
# SENDNOTICE "VPN to Homesite is Back Up" "VPN Tunnel is up" SENDNOTICE "VPN to Homesite is Back Up" "VPN Tunnel is up"
# rm -f ${NM_TMPFOLDER}/vpn-tunnel.down* rm -f ${NM_TMPFOLDER}/vpn-tunnel.down*
# fi fi
# fi fi
} }
BACKUP(){ BACKUP(){