From c7e6c970b54cea7c6733cf6b2d6b1677010b6ad3 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Thu, 24 Aug 2023 21:56:08 -0500 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index dc3973b4..1bb9c805 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -590,8 +590,7 @@ BACKUP_OFFSITEPFSENSE(){ dailyfilestokeep=(`ls -d ${BAKFOLDER}/*-D 2> /dev/null | tail -7`) weeklyfilestokeep=(`ls -d ${BAKFOLDER}/*-W 2> /dev/null | tail -4`) monthlyfilestokeep=(`ls -d ${BAKFOLDER}/*-M 2> /dev/null | tail -12`) - for i in $(ls -d ${BAKFOLDER}/*); do - keep=0 + for i in $(ls -d ${BAKFOLDER}/*); do; keep=0 if [[ "${i}" == *"-D"* ]]; then filestokeep=${dailyfilestokeep[@]} elif [[ "${i}" == *"-W"* ]]; then @@ -600,7 +599,9 @@ BACKUP_OFFSITEPFSENSE(){ filestokeep=${monthlyfilestokeep[@]} fi for a in ${filestokeep}; do - [ "${i}" == "${a}" ] && keep=1 + if [ "${i}" == "${a}" ]; then + keep=1; break + fi done; [ $keep == 0 ] && rm -rf ${i} done