diff options
author | Simon Paillard <spaillard@debian.org> | 2013-09-20 22:40:00 +0200 |
---|---|---|
committer | Simon Paillard <spaillard@debian.org> | 2013-10-15 00:21:08 +0200 |
commit | d922c4e0a421cab25dd2d5a99837c9f6029e2d94 (patch) | |
tree | ce796f70bf6a3946fd2f469827f3b77f766956f7 /etc | |
parent | cb2e07093daf737ac34dd9827a5ff96c34f72f79 (diff) |
Handling of trigger errors: fix logging and email reports
- No separate log file for errors
- One mail per faulty pushed mirror
Diffstat (limited to 'etc')
-rw-r--r-- | etc/common | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -95,7 +95,12 @@ signal () { # Default normal "fire and forget" push. We background that, we do not care about the mirrors doings log "Sending normal push" >> "${LOGDIR}/${MIRROR}.log" PUSHARGS1="sync:all" - ssh -f $SSH_OPTIONS "${HOSTNAME}" "${PUSHARGS} ${PUSHARGS1}" >>"${LOGDIR}/${MIRROR}.log" + ssh -n $SSH_OPTIONS "${HOSTNAME}" "${PUSHARGS} ${PUSHARGS1}" >>"${LOGDIR}/${MIRROR}.log" 2>&1 + if [ $? -eq 255 ]; then + error "Trigger to ${HOSTNAME} failed" >> "${LOG}" + else + log "Trigger to ${HOSTNAME} succeed" >> "${LOG}" + fi elif [ "xstagedx" = "x${PUSHTYPE}x" ] || [ "xmhopx" = "x${PUSHTYPE}x" ]; then # Want a staged push. Fine, lets do that. Not backgrounded. We care about the mirrors doings. log "Sending staged push" >> "${LOGDIR}/${MIRROR}.log" @@ -105,6 +110,11 @@ signal () { # Step1: Do a push to only sync stage1, do not background PUSHARGS1="sync:stage1" ssh $SSH_OPTIONS "${HOSTNAME}" "${PUSHARGS} ${PUSHARGS1}" >>"${LOGDIR}/${MIRROR}.log" 2>&1 + if [ $? -eq 255 ]; then + error "Trigger to ${HOSTNAME} failed" >> "${LOG}" + else + log "Trigger to ${HOSTNAME} succeed" >> "${LOG}" + fi touch "${PUSHLOCKOWN}" # Step2: Wait for all the other "lock"files to appear. @@ -153,6 +163,11 @@ signal () { PUSHARGS2="sync:stage2" log "Now doing the second stage push" >> "${LOGDIR}/${MIRROR}.log" ssh $SSH_OPTIONS "${HOSTNAME}" "${PUSHARGS} ${PUSHARGS2}" >>"${LOGDIR}/${MIRROR}.log" 2>&1 + if [ $? -eq 255 ]; then + error "Trigger to ${HOSTNAME} failed" >> "${LOG}" + else + log "Trigger to ${HOSTNAME} succeed" >> "${LOG}" + fi fi else # Can't decide? Then you get nothing. |