postgres backup, cleanup fixed

This commit is contained in:
Tommaso Piccioli 2018-04-16 17:09:18 +02:00
parent 2681156ce2
commit a00237de06
1 changed files with 5 additions and 1 deletions

View File

@ -41,7 +41,11 @@ create_backup_dirs() {
cleanup_old_backups() {
# Remove the old backups
find ${HISTDIR} -ctime +$N_DAYS_TO_SPARE -exec rm -f {} \;
TODELETE=`ls /var/lib/pgsql/backups/history | awk -F '.' '{print $NF}' | sort -ruV | tail -n +${N_DAYS_TO_SPARE}`
for i in ${TODELETE}
do
rm -f /var/lib/pgsql/backups/history/*.$i
done
}
create_db_list() {