]> git.decadent.org.uk Git - dak.git/blob - config/debian/cron.weekly
move dc9 talk to presentations git
[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 # ERR traps should be inherited from functions too. (And command
8 # substitutions and subshells and whatnot, but for us the functions is
9 # the important part here)
10 set -E
11 export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
12 . $SCRIPTVARS
13
14 # Start logging
15 NOW=`date "+%Y.%m.%d-%H:%M:%S"`
16 LOGFILE="$logdir/weekly_${NOW}.log"
17 exec > "$LOGFILE" 2>&1
18
19 cleanup() {
20   echo "Cleanup"
21   rm -f "$LOGFILE"
22 }
23 trap cleanup 0
24
25 ################################################################################
26
27 # Purge empty directories
28 echo "Purging empty directories in $ftpdir/pool/"
29
30 if [ ! -z "$(find $ftpdir/pool/ -type d -empty)" ]; then
31    find $ftpdir/pool/ -type d -empty | xargs rmdir;
32 fi
33
34 # Do git cleanup stuff
35 echo "Doing git stuff"
36 cd /srv/ftp.debian.org/git/dak.git
37 git gc --prune
38 git update-server-info
39 # now workaround a git bug not honoring the setup in logs/*
40 # (fix in development, but until it reached backports.org.......)
41 chmod -R g+w logs/
42
43 echo "Fixing symlinks in $ftpdir"
44 symlinks -d -r $ftpdir
45
46 echo "Finally, all is done, compressing logfile"
47 exec > /dev/null 2>&1
48
49 bzip2 -9 "$LOGFILE"
50
51
52 ################################################################################