diff --git a/templates/postgresql-backup.sh.j2 b/templates/postgresql-backup.sh.j2 index a1c8e3e..287974e 100755 --- a/templates/postgresql-backup.sh.j2 +++ b/templates/postgresql-backup.sh.j2 @@ -49,9 +49,9 @@ cleanup_old_backups() { # find ${HISTDIR} -mtime +${N_DAYS_TO_SPARE} -type f -exec rm -fv {} \; ORD_DUMP_TO_DEL=$( expr $N_DAYS_TO_SPARE + 1 ) TODELETE=$( /bin/ls "${HISTDIR}/" | awk -F '.' '{print $NF}' | sort -ruV | tail -n +${ORD_DUMP_TO_DEL} ) - for i in ${TODELETE} + for DATETODELETE in ${TODELETE} do - rm -f "${HISTDIR}/*.${i}" + rm -fv ${HISTDIR}/*.${DATETODELETE} done }