X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fdebian%2Fcron.weekly;h=99d16359365f196ce82c3325b3f46bbd8d987425;hb=d9822f04453a1b62ca0aa66e2efeea35f654778f;hp=8357d2ee8309fbbbbc52e582f8221d7ad158de02;hpb=59fd5aa2a8be3b76dbc968429c457f096adfa472;p=dak.git diff --git a/config/debian/cron.weekly b/config/debian/cron.weekly index 8357d2ee..99d16359 100755 --- a/config/debian/cron.weekly +++ b/config/debian/cron.weekly @@ -1,23 +1,49 @@ #!/bin/sh # -# Run once a week via cron, out of katie's crontab. +# Run once a week via cron, out of dak's crontab. set -e -export SCRIPTVARS=/org/ftp.debian.org/katie/vars +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$" -cd $masterdir +# 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" + + ################################################################################