From d6ba8ed668f25bd6f6e06c7c6d1965e9b010236f Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Wed, 5 Dec 2007 07:15:44 +0000 Subject: [PATCH] cron.daily: automatically bzip2 old backups --- config/debian/cron.daily | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/config/debian/cron.daily b/config/debian/cron.daily index 6d115cbe..059020eb 100755 --- a/config/debian/cron.daily +++ b/config/debian/cron.daily @@ -199,4 +199,16 @@ TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X) cd $configdir apt-ftparchive -q clean apt.conf +TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X) + +# Compress psql backups older than a month, but no more than 20 of them + +(cd $base/backup/ + find -maxdepth 1 -mindepth 1 -type f -name 'dump_*' \! -name '*.bz2' \! -name '*.gz' -mtime +30 | + sort | head -n20 | while read dumpname; do + echo "Compressing $dumpname" + bzip2 -9 "$dumpname" + done +) + ################################################################################ -- 2.39.2