From 312f327e0f8b2821f335ff6c6b39c91bdd451eef Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 15 Nov 2018 20:00:35 +0100 Subject: [PATCH] Use the old 'find' command to remove the old backups, until we fix the bug of the new procedure. --- postgresql/files/postgresql-backup.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/postgresql/files/postgresql-backup.sh b/postgresql/files/postgresql-backup.sh index ecf0ea8..76a837f 100755 --- a/postgresql/files/postgresql-backup.sh +++ b/postgresql/files/postgresql-backup.sh @@ -41,11 +41,12 @@ create_backup_dirs() { cleanup_old_backups() { # Remove the old backups - TODELETE=`ls ${BACKUPDIR}/history | awk -F '.' '{print $NF}' | sort -ruV | tail -n +${N_DAYS_TO_SPARE}` - for i in ${TODELETE} - do - rm -f ${BACKUPDIR}/history/*.$i - done + find ${HISTDIR} -ctime +${N_DAYS_TO_SPARE} -type f -exec rm -f {} \; + # TODELETE=$( /bin/ls "${HISTDIR}/" | awk -F '.' '{print $NF}' | sort -ruV | tail -n +${N_DAYS_TO_SPARE} ) + # for i in ${TODELETE} + # do + # rm -f "${HISTDIR}/*.${i}" + # done } create_db_list() {