X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fdebian%2Fcron.dinstall;h=babef86a1a9a6f17a112eaed3428a20be5b29aa5;hb=e0ef48cd237d4af31499adbb16606ce3d8b7ee4f;hp=7c3880806878c609da809e8149c75ad535fe6bef;hpb=603d8ace7d4f942c999c29556bde38ec2516b9a8;p=dak.git diff --git a/config/debian/cron.dinstall b/config/debian/cron.dinstall index 7c388080..babef86a 100755 --- a/config/debian/cron.dinstall +++ b/config/debian/cron.dinstall @@ -67,6 +67,10 @@ function cleanup() { rm -f ${LOCK_ACCEPTED} } +######################################################################## +# the actual dinstall functions follow # +######################################################################## + # Setup the notice file to tell bad mirrors they used the wrong time function notice() { rm -f "$NOTICE" @@ -340,7 +344,27 @@ function compress() { } function logstats() { - $masterdir/tools/logs.py "$LOGFILE" + $masterdir/tools/logs.py "$1" +} + +# save timestamp when we start +function savetimestamp() { + NOW=`date "+%Y.%m.%d-%H:%M:%S"` + echo ${NOW} > "${dbdir}/dinstallstart" +} + +function renamelogfile() { + if [ -f "${dbdir}/dinstallstart" ]; then + RENAMETO=$(cat "${dbdir}/dinstallstart") + mv "$LOGFILE" "$logdir/dinstall_${RENAMETO}.log" + logstats "$logdir/dinstall_${RENAMETO}.log" + bzip2 -9 "$logdir/dinstall_${RENAMETO}.log" + else + error "Problem, I don't know when dinstall started, unable to do log statistics." + NOW=`date "+%Y.%m.%d-%H:%M:%S"` + mv "$LOGFILE" "$logdir/dinstall_${NOW}.log" + bzip2 -9 "$logdir/dinstall_${NOW}.log" + fi } ######################################################################## @@ -464,6 +488,14 @@ trap cleanup EXIT ERR TERM HUP INT QUIT touch "${LOCK_BRITNEY}" +GO=( + FUNC="savetimestamp" + TIME="" + ARGS="" + ERR="false" +) +stage $GO + GO=( FUNC="notice" TIME="" @@ -737,17 +769,16 @@ log "Daily cron scripts successful, all done" exec > /dev/null 2>&1 +cat "$LOGFILE" | mail -s "Log for dinstall run of ${NOW}" cron@ftp-master.debian.org + GO=( - FUNC="logstats" + FUNC="renamelogfile" TIME="" ARGS="" - ERR="" + ERR="false" ) stage $GO -cat "$LOGFILE" | mail -s "Log for dinstall run of ${NOW}" cron@ftp-master.debian.org - -savelog -c ${LOGROTATE} -j "$LOGFILE" # Now, at the very (successful) end of dinstall, make sure we remove # our stage files, so the next dinstall run will do it all again.