]> git.decadent.org.uk Git - dak.git/blob - config/backports/cron.weekly
Merge remote-tracking branch 'ansgar/pu/multiarchive-1' into merge
[dak.git] / config / backports / cron.weekly
1 #!/bin/bash
2 #
3
4 set -e
5 set -o pipefail
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/backports-master.debian.org/dak/config/backports/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 if [ ! -z "$(find $ftpdir/pool/ -type d -empty)" ]; then
30    find $ftpdir/pool/ -type d -empty | xargs rmdir;
31 fi
32
33 # Clean up apt-ftparchive's databases
34 cd $configdir
35 #echo "Cleanup apt-ftparchive's database"
36 #apt-ftparchive -q clean apt.conf
37
38 echo "Fixing symlinks in $ftpdir"
39 symlinks -d -r $ftpdir
40
41 echo "Finally, all is done, compressing logfile"
42 exec > /dev/null 2>&1
43
44 bzip2 -9 "$LOGFILE"
45
46
47 ################################################################################