summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Jaspert <joerg@debian.org>2011-02-22 22:31:38 +0100
committerJoerg Jaspert <joerg@debian.org>2011-02-22 22:31:38 +0100
commite018547bb82fa4dce3baaa400d33294cb46a223d (patch)
tree60899b9fa296a31619f5497ec2d8cc9298d44859
parentc2d450c446668a2c10f7a83e917519e5b7a5231a (diff)
ftpsync
fix bug in rsync speed statistic output in a case where, for whatever reason, the logfile has been rotated away before we try to grep around in it. also update copyright years. Signed-off-by: Joerg Jaspert <joerg@debian.org>
-rwxr-xr-xbin/ftpsync23
1 files changed, 12 insertions, 11 deletions
diff --git a/bin/ftpsync b/bin/ftpsync
index 139b884..cf75049 100755
--- a/bin/ftpsync
+++ b/bin/ftpsync
@@ -12,7 +12,7 @@ set -E
# Based losely on a number of existing scripts, written by an
# unknown number of different people over the years.
#
-# Copyright (C) 2008,2009,2010 Joerg Jaspert <joerg@debian.org>
+# Copyright (C) 2008,2009,2010,2011 Joerg Jaspert <joerg@debian.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
@@ -108,16 +108,17 @@ cleanup() {
log "Mirrorsync done";
# Lets get a statistical value
- SPEED=$(
- SPEEDLINE=$(egrep '[0-9.]+ bytes/sec' ${LOGDIR}/rsync-${NAME}.log)
- set "nothing" ${SPEEDLINE}
- echo $8
- )
- if [ -n "${SPEED}" ]; then
- SPEED=${SPEED%%.*}
- SPEED=$(( $SPEED / 1024 ))
- else
- SPEED='unknown'
+ SPEED="unknown"
+ if [ -f "${LOGDIR}/rsync-${NAME}.log" ]; then
+ SPEED=$(
+ SPEEDLINE=$(egrep '[0-9.]+ bytes/sec' "${LOGDIR}/rsync-${NAME}.log")
+ set "nothing" ${SPEEDLINE}
+ echo $8
+ )
+ if [ -n "${SPEED}" ]; then
+ SPEED=${SPEED%%.*}
+ SPEED=$(( $SPEED / 1024 ))
+ fi
fi
log "Rsync transfer speed: ${SPEED} KB/s"