From 42c4580547a8df2274eaff5d8eaffe0e0907cb86 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 6 Jan 2016 16:07:26 +0100 Subject: Do stage1 tracefile at the end, if we only did stage1 --- bin/ftpsync | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bin/ftpsync b/bin/ftpsync index 385aa92..78f09de 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -205,11 +205,13 @@ tracefile() { echo "Architectures: ${out}" echo "Upstream-mirror: ${RSYNC_HOST}" total=0 - for bytes in $(egrep 'Total bytes received: ' "${LOGDIR}/rsync-${NAME}.log" | awk -F: '{print $2}'); do - bytes=${bytes//,} - total=$((total + bytes)) - done - echo "Total bytes received in rsync: ${total}" + if [[ -e "${LOGDIR}/rsync-${NAME}.log" ]]; then + for bytes in $(egrep 'Total bytes received: ' "${LOGDIR}/rsync-${NAME}.log" | awk -F: '{print $2}'); do + bytes=${bytes//,} + total=$((total + bytes)) + done + echo "Total bytes received in rsync: ${total}" + fi echo "Total time spent in rsync: ${STATS_TOTAL_RSYNC_TIME}" if [[ 0 != ${STATS_TOTAL_RSYNC_TIME} ]]; then rate=$(( total / STATS_TOTAL_RSYNC_TIME )) @@ -594,8 +596,6 @@ while [[ -e ${UPDATEREQUIRED} ]]; do exit 3 fi - tracefile "${TO}/${TRACE}-stage1" - HOOK=( HOOKNR=2 HOOKSCR=${HOOK2} @@ -678,6 +678,8 @@ done # Otherwise we would update it after stage1 already, which is wrong. if [[ true = ${SYNCSTAGE2} ]] || [[ true = ${SYNCALL} ]]; then tracefile +elif [[ true = ${SYNCSTAGE1} ]]; then + tracefile "${TO}/${TRACE}-stage1" fi -- cgit v1.2.3