summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2016-01-07 11:16:36 +0100
committerPeter Palfrader <peter@palfrader.org>2016-01-07 11:16:36 +0100
commit4db47241cf9926173e8ce50bb10a2caf6aa04d6d (patch)
tree5f49740f2f19b766f60e979f3036ada47d6983b6 /bin
parent0ec5190623ed4dbd20246c0db2d4d52d3f8a5144 (diff)
Also count stage2 rsync time
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ftpsync17
1 files changed, 12 insertions, 5 deletions
diff --git a/bin/ftpsync b/bin/ftpsync
index 908b947..8ecaf37 100755
--- a/bin/ftpsync
+++ b/bin/ftpsync
@@ -219,9 +219,12 @@ tracefile() {
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 ))
+ total_time=$(( STATS_TOTAL_RSYNC_TIME1 + STATS_TOTAL_RSYNC_TIME2 ))
+ echo "Total time spent in stage1 rsync: ${STATS_TOTAL_RSYNC_TIME1}"
+ echo "Total time spent in stage2 rsync: ${STATS_TOTAL_RSYNC_TIME2}"
+ echo "Total time spent in rsync: ${total_time}"
+ if [[ 0 != ${total_time} ]]; then
+ rate=$(( total / total_time ))
echo "Average rate: ${rate} B/s"
fi
fi # full trace
@@ -456,7 +459,8 @@ CALLBACKKEY=${CALLBACKKEY:-"none"}
EXCLUDE=${EXCLUDE:-""}
# collect some stats
-STATS_TOTAL_RSYNC_TIME=0
+STATS_TOTAL_RSYNC_TIME1=0
+STATS_TOTAL_RSYNC_TIME2=0
# The temp directory used by rsync --delay-updates is not
# world-readable remotely. Always exclude it to avoid errors.
@@ -599,7 +603,7 @@ while [[ -e ${UPDATEREQUIRED} ]]; do
${RSYNCPTH}::${RSYNC_PATH} "${TO}" >>"${LOGDIR}/rsync-${NAME}.log" 2>>"${LOGDIR}/rsync-${NAME}.error"
result=$?
rsync_ended=$(date +%s)
- STATS_TOTAL_RSYNC_TIME=$(( STATS_TOTAL_RSYNC_TIME + rsync_ended - rsync_started ))
+ STATS_TOTAL_RSYNC_TIME1=$(( STATS_TOTAL_RSYNC_TIME1 + rsync_ended - rsync_started ))
set -e
log "Back from rsync with returncode ${result}"
@@ -669,9 +673,12 @@ while [[ -e ${UPDATEREQUIRED} ]]; do
set +e
# We are lucky, it worked. Now do step 2 and sync again, this time including
# the packages/releases files
+ rsync_started=$(date +%s)
${RSYNC} ${RSYNC_OPTIONS} ${RSYNC_OPTIONS2} ${EXCLUDE} ${SOURCE_EXCLUDE} \
${RSYNCPTH}::${RSYNC_PATH} "${TO}" >>"${LOGDIR}/rsync-${NAME}.log" 2>>"${LOGDIR}/rsync-${NAME}.error"
result=$?
+ rsync_ended=$(date +%s)
+ STATS_TOTAL_RSYNC_TIME2=$(( STATS_TOTAL_RSYNC_TIME2 + rsync_ended - rsync_started ))
set -e
log "Back from rsync with returncode ${result}"