From: Frank Lichtenheld Date: Sun, 15 Apr 2007 14:17:16 +0000 (+0200) Subject: extract_changelogs: Merge cron job changes from old site X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=e869cc49fe3143487be56136b0b25904ac2ee154;p=deb%2Fpackages.git extract_changelogs: Merge cron job changes from old site Merge the new daily cron job scripts from old site that splits the extract_changelogs from the rest of the cron job. This avoids delaying the rest of the cronjob for the changelog extraction. Using two different lock files also makes the whole site update more robust. --- diff --git a/bin/daily b/bin/daily index f9e8853..0a67587 100755 --- a/bin/daily +++ b/bin/daily @@ -39,7 +39,15 @@ then run-parts --verbose $topdir/cron.d >> $log 2>&1 rm -f "${files}/cron.lock" else - echo "couldn't aquire lock file in due time" >> $log + echo "couldn't aquire cron lock file in due time" >> $log fi +date >> $log +if lockfile -600 -r5 "${files}/changelogs.lock" >> $log 2>&1 +then + $topdir/bin/extract_changelogs >> $log 2>&1 + rm -f "${files}/changelogs.lock" +else + echo "couldn't aquire changelogs lock file in due time" >> $log +fi date >> $log diff --git a/bin/extract_changelogs b/bin/extract_changelogs new file mode 100755 index 0000000..08be087 --- /dev/null +++ b/bin/extract_changelogs @@ -0,0 +1,46 @@ +#!/bin/bash + +. `dirname $0`/../config.sh + +if test -z "${localdir}"; then + echo skipping due to missing local archive + exit 1 +fi + +#set -e + +NOCPY_TEMPLATE=$topdir/etc/copyright_error +NOCPY_BIN_TEMPLATE=$topdir/etc/copyright_error_bin + +logs="$topdir/files/logs" +log="${logs}/changelogs.log" + +test -d "$logs" || mkdir -p "$logs" +test -d "$tmpdir" || mkdir -p "$tmpdir" + +if [ -s "$log" ] +then + savelog -c 14 "$log" > /dev/null +fi + +( +date + +for part in $parts; do + time "${bindir}/extract_files" -v -d "${localdir}/pool/$part/" \ + -t "${htmldir}/changelogs/pool/$part/" \ + -c "$configdir" -w "$tmpdir" \ + --dumpfile "${filesdir}/changelogs.$part.dump" \ + --cachefile "${filesdir}/changelogs.cache" +done + +find "${htmldir}/changelogs/" -name log -cmin +7200 \ + | while read logfile; do + dir=$(dirname "$logfile") + echo deleting $dir + rm -r "$dir" + rmdir --ignore-fail-on-non-empty $(dirname "$dir") +done + +date +) > $log 2>&1 diff --git a/config.sh.sed.in b/config.sh.sed.in index 1868bce..fffd884 100644 --- a/config.sh.sed.in +++ b/config.sh.sed.in @@ -20,7 +20,7 @@ cachedir=${topdir}/cache # unset this if %SITE% moves somewhere where the packages files # cannot be obtained locally # -#localdir=/org/ftp.debian.org/ftp +localdir=/org/ftp.debian.org/ # path to private ftp directory #ftproot=/org/ftp.root diff --git a/cron.d/300extract_changelogs b/cron.d/300extract_changelogs deleted file mode 100755 index d969781..0000000 --- a/cron.d/300extract_changelogs +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -exit 0 - -. `dirname $0`/../config.sh - -if test -z "${localdir}"; then - echo skipping due to missing local archive - exit 1 -fi - -#set -e - -NOCPY_TEMPLATE=$topdir/etc/copyright_error -NOCPY_BIN_TEMPLATE=$topdir/etc/copyright_error_bin - -logs="$topdir/files/logs" -log="${logs}/changelogs.log" - -test -d "$logs" || mkdir -p "$logs" -test -d "$tmpdir" || mkdir -p "$tmpdir" - -if [ -s "$log" ] -then - savelog -c 14 "$log" > /dev/null -fi - -( -date - -for part in $parts; do - time "${bindir}/extract_files" -v -d "${localdir}/pool/$part/" \ - -t "${htmldir}/changelogs/pool/$part/" \ - -c "$configdir" -w "$tmpdir" \ - --dumpfile "${filesdir}/changelogs.$part.dump" \ - --cachefile "${filesdir}/changelogs.cache" -done - -find "${htmldir}/changelogs/" -name log -cmin +7200 \ - | while read logfile; do - dir=$(dirname "$logfile") - echo deleting $dir - rm -r "$dir" - rmdir --ignore-fail-on-non-empty $(dirname "$dir") -done - -date -) > $log 2>&1