From 2ca05f92fad6fa29eb8b6461df161f4244f63712 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 10 May 2025 15:36:39 -0500 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 48 ++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index b090518e..61eb1d76 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -744,30 +744,30 @@ BACKUP_UNIFINVR(){ fi fi - dailyfilestokeep=(`ls -d ${BAKFOLDER}/*-D 2> /dev/null | tail -${DailyBackupsToKeep}`) - weeklyfilestokeep=(`ls -d ${BAKFOLDER}/*-W 2> /dev/null | tail -${WeeklyBackupsToKeep}`) - monthlyfilestokeep=(`ls -d ${BAKFOLDER}/*-M 2> /dev/null | tail -${MonthlyBackupsToKeep}`) - for folder in $(ls -d ${BAKFOLDER}/*); do - if [ "${folder}" != "${BAKFOLDER}/mounted" ]; then - if [[ "${folder}" == *"-D"* ]]; then - filestokeep=${dailyfilestokeep[@]} - elif [[ "${folder}" == *"-W"* ]]; then - filestokeep=${weeklyfilestokeep[@]} - elif [[ "${folder}" == *"-M"* ]]; then - filestokeep=${monthlyfilestokeep[@]} - fi - keep=0 - for file in ${filestokeep}; do - if [ "${folder}" == "${file}" ]; then - keep=1; break - fi - done; - if [ $keep == 0 ]; then - delFolder="D:\\BackupSync\\UniFi-Backups\\UniFi-NVR_Backups\\${folder##*/}" - ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 backup@10.10.1.60 cmd /C rmdir /S /Q "${delFolder}" - fi - fi - done + # dailyfilestokeep=(`ls -d ${BAKFOLDER}/*-D 2> /dev/null | tail -${DailyBackupsToKeep}`) + # weeklyfilestokeep=(`ls -d ${BAKFOLDER}/*-W 2> /dev/null | tail -${WeeklyBackupsToKeep}`) + # monthlyfilestokeep=(`ls -d ${BAKFOLDER}/*-M 2> /dev/null | tail -${MonthlyBackupsToKeep}`) + # for folder in $(ls -d ${BAKFOLDER}/*); do + # if [ "${folder}" != "${BAKFOLDER}/mounted" ]; then + # if [[ "${folder}" == *"-D"* ]]; then + # filestokeep=${dailyfilestokeep[@]} + # elif [[ "${folder}" == *"-W"* ]]; then + # filestokeep=${weeklyfilestokeep[@]} + # elif [[ "${folder}" == *"-M"* ]]; then + # filestokeep=${monthlyfilestokeep[@]} + # fi + # keep=0 + # for file in ${filestokeep}; do + # if [ "${folder}" == "${file}" ]; then + # keep=1; break + # fi + # done; + # if [ $keep == 0 ]; then + # delFolder="D:\\BackupSync\\UniFi-Backups\\UniFi-NVR_Backups\\${folder##*/}" + # ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 backup@10.10.1.60 cmd /C rmdir /S /Q "${delFolder}" + # fi + # fi + # done else SENDNOTICE "UniFi-NVR Backup Failed" "Could not contact 'NVR @ ${UNIFINVR_IP}' for backup" 1 fi