Update nodemgmt-scripts.sh
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user