X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fdebian%2Fcron.dinstall;h=1f0e1961a86f8113b3de2788f1bdff754b62d9f6;hb=4053937754287e909af9017a9b191d48ef567f40;hp=7b0548f757836b9e71b04e4aed91dde4d037c9c5;hpb=467617773bd7761c71189c0505ccdc7536689fa2;p=dak.git diff --git a/config/debian/cron.dinstall b/config/debian/cron.dinstall index 7b0548f7..1f0e1961 100755 --- a/config/debian/cron.dinstall +++ b/config/debian/cron.dinstall @@ -43,6 +43,12 @@ function cleanup() { rm -f ${LOCK_ACCEPTED} } +# If we error out this one is called, *FOLLOWED* by cleanup above +function onerror() { + ERRDATE=$(date "+%Y.%m.%d-%H:%M:%S") + cat "$LOGFILE" | mail -s "ATTENTION ATTENTION! dinstall error at ${ERRDATE} (Be quiet, Brain, or I'll stab you with a Q-tip)" cron@ftp-master.debian.org +} + ######################################################################## # the actual dinstall functions follow # ######################################################################## @@ -216,7 +222,7 @@ function release() { function dakcleanup() { log "Cleanup old packages/files" - dak clean-suites + dak clean-suites -m 10000 dak clean-queues } @@ -278,9 +284,9 @@ function bts() { } function merkel2() { - # Push katie@merkel so it syncs the projectb there. Returns immediately, the sync runs detached + # Push dak@merkel so it syncs the projectb there. Returns immediately, the sync runs detached log "Trigger merkels projectb sync" - ssh -2 -o BatchMode=yes -o SetupTimeOut=30 -o ConnectTimeout=30 -i ~/.ssh/push_merkel_projectb katie@merkel.debian.org sleep 1 + ssh -2 -o BatchMode=yes -o SetupTimeOut=30 -o ConnectTimeout=30 -i ~/.ssh/push_merkel_projectb dak@merkel.debian.org sleep 1 } function runparts() { @@ -340,18 +346,24 @@ function savetimestamp() { echo ${NOW} > "${dbdir}/dinstallstart" } +function maillogfile() { + cat "$LOGFILE" | mail -s "Log for dinstall run of ${NOW}" cron@ftp-master.debian.org +} + 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 + if [ -f "${dbdir}/dinstallstart" ]; then + NOW=$(cat "${dbdir}/dinstallstart") + maillogfile + mv "$LOGFILE" "$logdir/dinstall_${NOW}.log" + logstats "$logdir/dinstall_${NOW}.log" + bzip2 -9 "$logdir/dinstall_${NOW}.log" + else + error "Problem, I don't know when dinstall started, unable to do log statistics." + NOW=`date "+%Y.%m.%d-%H:%M:%S"` + maillogfile + mv "$LOGFILE" "$logdir/dinstall_${NOW}.log" + bzip2 -9 "$logdir/dinstall_${NOW}.log" + fi } function testingsourcelist() { @@ -398,10 +410,10 @@ function stage() { # it has to cd first! cd ${configdir} - if [ -f "${LOCK_STOP}" ]; then - log "${LOCK_STOP} exists, exiting immediately" - exit 42 - fi + if [ -f "${LOCK_STOP}" ]; then + log "${LOCK_STOP} exists, exiting immediately" + exit 42 + fi if [ "${ERR}" = "false" ]; then set +e @@ -420,10 +432,10 @@ function stage() { ts "${TIME}" fi - if [ -f "${LOCK_STOP}" ]; then - log "${LOCK_STOP} exists, exiting immediately" - exit 42 - fi + if [ -f "${LOCK_STOP}" ]; then + log "${LOCK_STOP} exists, exiting immediately" + exit 42 + fi } ######################################################################## @@ -480,7 +492,8 @@ LOCK_BRITNEY="$lockdir/britney.lock" LOCK_STOP="$lockdir/archive.stop" lockfile -l 3600 "${LOCK_DAILY}" -trap cleanup EXIT ERR TERM HUP INT QUIT +trap onerror ERR +trap cleanup EXIT TERM HUP INT QUIT touch "${LOCK_BRITNEY}" @@ -678,10 +691,10 @@ GO=( stage $GO GO=( - FUNC="pgdakdev" - TIME="dak-dev db" - ARGS="" - ERR="false" + FUNC="pgdakdev" + TIME="dak-dev db" + ARGS="" + ERR="false" ) stage $GO @@ -725,8 +738,6 @@ GO=( ) stage $GO -ulimit -m 90000 -d 90000 -s 10000 -v 200000 - GO=( FUNC="runparts" TIME="run-parts" @@ -780,8 +791,6 @@ log "Daily cron scripts successful, all done" exec > "$logdir/afterdinstall.log" 2>&1 -cat "$LOGFILE" | mail -s "Log for dinstall run of ${NOW}" cron@ftp-master.debian.org - GO=( FUNC="renamelogfile" TIME=""