X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fdebian%2Fcron.weekly;h=45677cd97bb854b790a6d1f7cf94f2e9434dd905;hb=68562655cac81254aa9e8cbd352410df42816a2e;hp=8357d2ee8309fbbbbc52e582f8221d7ad158de02;hpb=59fd5aa2a8be3b76dbc968429c457f096adfa472;p=dak.git diff --git a/config/debian/cron.weekly b/config/debian/cron.weekly index 8357d2ee..45677cd9 100755 --- a/config/debian/cron.weekly +++ b/config/debian/cron.weekly @@ -1,23 +1,66 @@ #!/bin/sh # -# Run once a week via cron, out of katie's crontab. +# Run once a week via cron, out of dak's crontab. set -e -export SCRIPTVARS=/org/ftp.debian.org/katie/vars +set -u +# ERR traps should be inherited from functions too. (And command +# substitutions and subshells and whatnot, but for us the functions is +# the important part here) +set -E +export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars . $SCRIPTVARS +# Start logging +NOW=`date "+%Y.%m.%d-%H:%M:%S"` +LOGFILE="$logdir/weekly_${NOW}.log" +exec > "$LOGFILE" 2>&1 + +cleanup() { + echo "Cleanup" + rm -f "$LOGFILE" +} +trap cleanup 0 + ################################################################################ # Purge empty directories +echo "Purging empty directories in $ftpdir/pool/" if [ ! -z "$(find $ftpdir/pool/ -type d -empty)" ]; then find $ftpdir/pool/ -type d -empty | xargs rmdir; fi -# Clean up apt-ftparchive's databases +# Split queue/done +echo "Splitting queue/done" +dak split-done > /dev/null -cd $masterdir +# Do git cleanup stuff +echo "Doing git stuff" +cd /srv/ftp.debian.org/git/dak.git +git gc --prune +git update-server-info +# now workaround a git bug not honoring the setup in logs/* +# (fix in development, but until it reached backports.org.......) +chmod -R g+w logs/ + +# Clean up apt-ftparchive's databases +cd $configdir +echo "Cleanup apt-ftparchive's database" apt-ftparchive -q clean apt.conf apt-ftparchive -q clean apt.conf.buildd +# Update wanna-build dump +echo "Update wanna-build database dump" +$base/dak/scripts/nfu/get-w-b-db + +echo "Fixing symlinks in $ftpdir" +symlinks -d -r $ftpdir + +echo "Finally, all is done, compressing logfile" +exec > /dev/null 2>&1 + +bzip2 -9 "$LOGFILE" + + ################################################################################