]> git.decadent.org.uk Git - dak.git/blob - config/debian/cron.weekly
Remove trailing / from path
[dak.git] / config / debian / cron.weekly
1 #!/bin/sh
2 #
3 # Run once a week via cron, out of dak's crontab.
4
5 set -e
6 set -u
7 export SCRIPTVARS=/srv/ftp.debian.org/dak/config/debian/vars
8 . $SCRIPTVARS
9
10 # Start logging
11 NOW=`date "+%Y.%m.%d-%H:%M:%S"`
12 LOGFILE="$logdir/weekly_${NOW}.log"
13 exec > "$LOGFILE" 2>&1
14
15 cleanup() {
16   echo "Cleanup"
17   rm -f "$LOGFILE"
18 }
19 trap cleanup 0
20
21 ################################################################################
22
23 # Purge empty directories
24 echo "Purging empty directories in $ftpdir/pool/"
25
26 if [ ! -z "$(find $ftpdir/pool/ -type d -empty)" ]; then
27    find $ftpdir/pool/ -type d -empty | xargs rmdir;
28 fi
29
30 # Split queue/done
31 echo "Splitting queue/done"
32 dak split-done > /dev/null
33
34 # Vacuum the database
35 echo "VACUUM; VACUUM ANALYZE;" | psql --no-psqlrc projectb 2>&1 | grep -v "^NOTICE:  Skipping.*only table owner can VACUUM it$"
36
37 # Do git cleanup stuff
38 echo "Doing git stuff"
39 cd /org/ftp.debian.org/git/dak.git
40 git gc --prune
41 git update-server-info
42 # now workaround a git bug not honoring the setup in logs/*
43 # (fix in development, but until it reached backports.org.......)
44 chmod -R g+w logs/
45
46 # Clean up apt-ftparchive's databases
47 cd $configdir
48 echo "Cleanup apt-ftparchive's database"
49 apt-ftparchive -q clean apt.conf
50 apt-ftparchive -q clean apt.conf.buildd
51
52 # Update wanna-build dump
53 echo "Update wanan-build database dump"
54 /org/ftp.debian.org/scripts/nfu/get-w-b-db
55
56 echo "Finally, all is done, compressing logfile"
57 exec > /dev/null 2>&1
58
59 bzip2 -9 "$LOGFILE"
60
61
62 ################################################################################