diff options
author | Peter Palfrader <peter@palfrader.org> | 2016-01-06 15:35:08 +0100 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2016-01-06 15:35:08 +0100 |
commit | 4654fd62f4e8ed6f8d9783f465f04ae18b68d4e5 (patch) | |
tree | 19fb88ae654b1f1008e70aa2de33cc6972c428ac | |
parent | b013043031d4b51b3bca29ea8d386f688164e435 (diff) |
Do not divide by zero
-rwxr-xr-x | bin/ftpsync | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/ftpsync b/bin/ftpsync index ad53598..385aa92 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -211,8 +211,10 @@ tracefile() { done echo "Total bytes received in rsync: ${total}" echo "Total time spent in rsync: ${STATS_TOTAL_RSYNC_TIME}" - rate=$(( total / STATS_TOTAL_RSYNC_TIME )) - echo "Average rate: ${rate} B/s" + if [[ 0 != ${STATS_TOTAL_RSYNC_TIME} ]]; then + rate=$(( total / STATS_TOTAL_RSYNC_TIME )) + echo "Average rate: ${rate} B/s" + fi fi # full trace fi # other traces } > "${TRACEFILE}.new" |