summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Jaspert <joerg@debian.org>2010-10-10 11:45:13 +0200
committerJoerg Jaspert <joerg@debian.org>2010-10-10 11:45:13 +0200
commit6cf84aae1c5a6c681592e82157d13f8801ba1314 (patch)
tree5fada963e836b15fd7d040302dafc56df56dab86
parent85c0d9721c5ef29d90e883cd3f04e2a8f7301bfe (diff)
bwlimit
specify RSYNC_BW to limit rsyncs bandwidth. value in kb. 0 or unset means unlimited Signed-off-by: Joerg Jaspert <joerg@debian.org>
-rwxr-xr-xbin/ftpsync8
-rw-r--r--etc/ftpsync.conf.sample5
2 files changed, 11 insertions, 2 deletions
diff --git a/bin/ftpsync b/bin/ftpsync
index 580a80f..c489581 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 Joerg Jaspert <joerg@debian.org>
+# Copyright (C) 2008,2009,2010 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
@@ -277,6 +277,8 @@ RSYNC=${RSYNC:-rsync}
# Rsync filter rules. Used to protect various files we always want to keep, even if we otherwise delete
# excluded files
RSYNC_FILTER=${RSYNC_FILTER:-"--filter=protect_Archive-Update-in-Progress-${MIRRORNAME} --filter=protect_${TRACE} --filter=protect_Archive-Update-Required-${MIRRORNAME}"}
+# limit I/O bandwidth. Value is KBytes per second, unset or 0 is unlimited
+RSYNC_BW=${RSYNC_BW:-0}
# Default rsync options for *every* rsync call
RSYNC_OPTIONS=${RSYNC_OPTIONS:-"-prltvHSB8192 --timeout 3600 --stats ${RSYNC_FILTER}"}
# Options we only use in the first pass, where we do not want packages/sources to fly in yet and dont want to delete files
@@ -286,6 +288,10 @@ RSYNC_OPTIONS2=${RSYNC_OPTIONS2:-"--max-delete=40000 --delay-updates --delete --
# Which rsync share to use on our upstream mirror?
RSYNC_PATH=${RSYNC_PATH:-"ftp"}
+# Now add the bwlimit option. As default is 0 we always add it, rsync interprets
+# 0 as unlimited, so this is safe.
+RSYNC_OPTIONS="--bwlimit=${RSYNC_BW} ${RSYNC_OPTIONS}"
+
# We have no default host to sync from, but will error out if its unset
RSYNC_HOST=${RSYNC_HOST:-""}
# Error out if we have no host to sync from
diff --git a/etc/ftpsync.conf.sample b/etc/ftpsync.conf.sample
index e6615e7..f4f1ae5 100644
--- a/etc/ftpsync.conf.sample
+++ b/etc/ftpsync.conf.sample
@@ -61,7 +61,7 @@
## Use as space seperated list.
## Possible values are:
## alpha, amd64, arm, armel, hppa, hurd-i386, i386, ia64, kfreebsd-amd64,
-## kfreebsd-i386, m68k, mipsel, mips, powerpc, s390, sh and sparc
+## kfreebsd-i386, m68k, mipsel, mips, powerpc, s390, sh, sparc and source
## eg. ARCH_EXCLUDE="alpha arm armel mipsel mips s390 sparc"
## An unset value will mirror all architectures (default!)
#ARCH_EXCLUDE=""
@@ -101,6 +101,9 @@
## BE VERY CAREFUL WHEN YOU CHANGE THE RSYNC_OPTIONS! BETTER DON'T!
## BE VERY CAREFUL WHEN YOU CHANGE THE RSYNC_OPTIONS! BETTER DON'T!
+## limit I/O bandwidth. Value is KBytes per second, unset or 0 means unlimited
+#RSYNC_BW=""
+
## Default rsync options every rsync invocation sees.
#RSYNC_OPTIONS="-prltvHSB8192 --timeout 3600 --stats --exclude Archive-Update-in-Progress-${MIRRORNAME} --exclude ${TRACE} --exclude Archive-Update-Required-${MIRRORNAME}"