X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fdebian%2Fcron.weekly;h=99d16359365f196ce82c3325b3f46bbd8d987425;hb=d9822f04453a1b62ca0aa66e2efeea35f654778f;hp=2c159380bc0014a82261d57a4712d38323cd5448;hpb=342a24f0e31c3b6637cd9926235c514f531ad604;p=dak.git diff --git a/config/debian/cron.weekly b/config/debian/cron.weekly index 2c159380..99d16359 100755 --- a/config/debian/cron.weekly +++ b/config/debian/cron.weekly @@ -4,21 +4,46 @@ set -e set -u -export SCRIPTVARS=/org/ftp.debian.org/dak/config/debian/vars +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" + + ################################################################################