]> git.decadent.org.uk Git - dak.git/blob - config/backports/cron.weekly
Remove split-done.
[dak.git] / config / backports / cron.weekly
1 #!/bin/bash
2 #
3
4 set -e
5 set -u
6 # ERR traps should be inherited from functions too. (And command
7 # substitutions and subshells and whatnot, but for us the functions is
8 # the important part here)
9 set -E
10 export SCRIPTVARS=/srv/backports-master.debian.org/dak/config/backports/vars
11 . $SCRIPTVARS
12
13 # Start logging
14 NOW=`date "+%Y.%m.%d-%H:%M:%S"`
15 LOGFILE="$logdir/weekly_${NOW}.log"
16 exec > "$LOGFILE" 2>&1
17
18 cleanup() {
19   echo "Cleanup"
20   rm -f "$LOGFILE"
21 }
22 trap cleanup 0
23
24 ################################################################################
25
26 # Purge empty directories
27 echo "Purging empty directories in $ftpdir/pool/"
28 if [ ! -z "$(find $ftpdir/pool/ -type d -empty)" ]; then
29    find $ftpdir/pool/ -type d -empty | xargs rmdir;
30 fi
31
32 # Clean up apt-ftparchive's databases
33 cd $configdir
34 #echo "Cleanup apt-ftparchive's database"
35 #apt-ftparchive -q clean apt.conf
36
37 echo "Fixing symlinks in $ftpdir"
38 symlinks -d -r $ftpdir
39
40 echo "Finally, all is done, compressing logfile"
41 exec > /dev/null 2>&1
42
43 bzip2 -9 "$LOGFILE"
44
45
46 ################################################################################