]> git.decadent.org.uk Git - dak.git/blob - config/debian/cron.weekly
Remove .bzrignore and do a little git housekeeping in cron.weekly
[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
43 # Clean up apt-ftparchive's databases
44 cd $configdir
45 echo "Cleanup apt-ftparchive's database"
46 apt-ftparchive -q clean apt.conf
47 apt-ftparchive -q clean apt.conf.buildd
48
49 echo "Finally, all is done, compressing logfile"
50 exec > /dev/null 2>&1
51
52 bzip2 -9 "$LOGFILE"
53
54
55 ################################################################################