X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fdebian%2Fcron.weekly;h=99d16359365f196ce82c3325b3f46bbd8d987425;hb=d9822f04453a1b62ca0aa66e2efeea35f654778f;hp=53c866f2a24c63f3971e040b82e78dbca932ec67;hpb=6f984c8f09377f51ea631e9bbfcd9ab02a39f993;p=dak.git diff --git a/config/debian/cron.weekly b/config/debian/cron.weekly index 53c866f2..99d16359 100755 --- a/config/debian/cron.weekly +++ b/config/debian/cron.weekly @@ -7,18 +7,43 @@ set -u export SCRIPTVARS=/srv/ftp.debian.org/dak/config/debian/vars . $SCRIPTVARS +# Start logging +NOW=`date "+%Y.%m.%d-%H:%M:%S"` +LOGFILE="$logdir/weekly_${NOW}.log" +exec > "$LOGFILE" 2>&1 + +cleanup() { + echo "Cleanup" + rm -f "$LOGFILE" +} +trap cleanup 0 + ################################################################################ # Purge empty directories +echo "Purging empty directories in $ftpdir/pool/" if [ ! -z "$(find $ftpdir/pool/ -type d -empty)" ]; then find $ftpdir/pool/ -type d -empty | xargs rmdir; fi -# Clean up apt-ftparchive's databases +# Split queue/done +echo "Splitting queue/done" +dak split-done > /dev/null + +# Vacuum the database +echo "VACUUM; VACUUM ANALYZE;" | psql --no-psqlrc projectb 2>&1 | grep -v "^NOTICE: Skipping.*only table owner can VACUUM it$" +# Clean up apt-ftparchive's databases cd $configdir +echo "Cleanup apt-ftparchive's database" apt-ftparchive -q clean apt.conf apt-ftparchive -q clean apt.conf.buildd +echo "Finally, all is done, compressing logfile" +exec > /dev/null 2>&1 + +bzip2 -9 "$LOGFILE" + + ################################################################################