From: Anthony Towns Date: Wed, 5 Dec 2007 07:15:44 +0000 (+0000) Subject: cron.daily: automatically bzip2 old backups X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6ba8ed668f25bd6f6e06c7c6d1965e9b010236f;p=dak cron.daily: automatically bzip2 old backups --- 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 +) + ################################################################################