From 538071ea347dc63134067231c1ee2a2f4377a74c Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Wed, 10 Apr 2024 22:30:56 -0500 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index e88b46a5..794626cf 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -24,6 +24,13 @@ fi [ -f ${NM_BACKUP_FOLDER}/templates/*.config ] && rm -f ${NM_BACKUP_FOLDER}/templates/*.config +OFFSITE_STATICROUTE_FIX(){ + if [ "$(CHECK_HOST 10.10.0.1)" = "false" ] && [ "$(CHECK_HOST ${NM_OFFSITE_GW_IP})" != "false" ] && [ "$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_OFFSITE_GW_IP} ip r | grep 10.10.0.0)" = "" ]; then + routeinfo=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_OFFSITE_GW_IP} ip r | grep 10.10.0.0) + 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 Routen to Homesite Missing" "Re-added the static route onto the UniFi Gateway" + fi +} BACKUP(){ BACKUP_FOLDER=${NM_BACKUP_FOLDER}/node-backup/$(date +%m-%d-%y)/$(date +%H-%M-%S) @@ -384,7 +391,7 @@ NODEUPDATE(){ fi betacheck=$(BETACHECK) - if [ "${nip}" != "100.100.2.1" ] && [ "${nip}" != "10.2.1.1" ] && [ ! -f ${NM_TMPFOLDER}/${nip}.down ] && [ "$(CHECK_HOST ${nip})" != "false" ]; then + if [ "${nip}" != "100.100.2.1" ] && [ "${nip}" != "${NM_OFFSITE_GW_IP}" ] && [ ! -f ${NM_TMPFOLDER}/${nip}.down ] && [ "$(CHECK_HOST ${nip})" != "false" ]; then if [ "${betacheck}" == "false" ]; then if [ "${2}" != "sync" ]; then [ ${noup} -eq 0 ] && echo -en " ~ ${idsCL[LightCyan]}NodeMGMT${idsCL[Default]} : " >> ${tmpfile}.running @@ -528,9 +535,8 @@ UPDATE_DYNDNS(){ BACKUP_OFFSITEPFSENSE(){ BAKFOLDER=/mnt/Veeam-pfSense-Backups - OFFSITE_PFSENSE_IP='10.2.1.1' - if [ "$(CHECK_HOST ${OFFSITE_PFSENSE_IP})" != "false" ]; then + if [ "$(CHECK_HOST ${NM_OFFSITE_GW_IP})" != "false" ]; then if [ ! -f ${BAKFOLDER}/mounted ]; then mount -a sleep 2s @@ -549,9 +555,9 @@ BACKUP_OFFSITEPFSENSE(){ WeeklyBackupsToKeep=8 MonthlyBackupsToKeep=3 - ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${OFFSITE_PFSENSE_IP} tar -c -f /cf/conf/conf_backup.tar.gz /cf/conf - scp root@${OFFSITE_PFSENSE_IP}:/cf/conf/conf* ${BAKFOLDER}/${newBAKFOLDER}/ - ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${OFFSITE_PFSENSE_IP} rm -f /cf/conf/conf_backup.tar.gz + ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_OFFSITE_GW_IP} tar -c -f /cf/conf/conf_backup.tar.gz /cf/conf + scp root@${NM_OFFSITE_GW_IP}:/cf/conf/conf* ${BAKFOLDER}/${newBAKFOLDER}/ + ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_OFFSITE_GW_IP} rm -f /cf/conf/conf_backup.tar.gz cd ${BAKFOLDER} if [ "$(date +%d)" == "${DOM}" ] && [ "$(date +%u)" == "${DOW}" ]; then @@ -593,7 +599,7 @@ BACKUP_OFFSITEPFSENSE(){ fi done else - SENDNOTICE "Offsite pfSense Backup Failed" "Could not contact 'pfSense @ ${OFFSITE_PFSENSE_IP}' for backup" 1 + SENDNOTICE "Offsite pfSense Backup Failed" "Could not contact 'pfSense @ ${NM_OFFSITE_GW_IP}' for backup" 1 fi } @@ -1226,6 +1232,9 @@ GUI(){ betacheck) BETACHECK;; update-dyndns) UPDATE_DYNDNS ${2} ${3} ${4} ${5} ${6};; backup) BACKUP;; + + offsite-staticroute-fix) OFFSITE_STATICROUTE_FIX;; + dl|downlist) if [ "${2}" = "report" ]; then if [ "$(find ${NM_FOLDER} -name '*.down')" != "" ]; then