Add Jamie McClelland's cstream patches
authorMicah Anderson <micah@riseup.net>
Fri, 15 Dec 2006 23:13:47 +0000 (23:13 +0000)
committerMicah Anderson <micah@riseup.net>
Fri, 15 Dec 2006 23:13:47 +0000 (23:13 +0000)
AUTHORS
etc/backupninja.conf.in
examples/example.rdiff
handlers/rdiff
src/backupninja.in

diff --git a/AUTHORS b/AUTHORS
index fd30f8e3bcc376f5ed7fc0416ea98989c35ed3e1..03a9de4f0a73e082924c00324906ae0ecd83f1e0 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -19,5 +19,5 @@ Daniel.Bonniot@inria.fr
 Brad Fritz <brad@fritzfam.com> -- trac patch
 garcondumonde@riseup.net
 Martin Krafft madduck@debian.org -- admingroup patch
-Anarcat
-
+Anarcat -- lotsa patches
+Jamie McClelland - cstream patches
index 951a8ca5153e482f58fc2b7cbd5c5606c65ecafb..090561f594916a8acdc1891c78e2400ad0b3b242 100644 (file)
@@ -62,6 +62,7 @@ vservers = no
 # SLAPCAT=/usr/sbin/slapcat
 # LDAPSEARCH=/usr/bin/ldapsearch
 # RDIFFBACKUP=/usr/bin/rdiff-backup
+# CSTREAM=/usr/bin/cstream
 # MYSQL=/usr/bin/mysql
 # MYSQLHOTCOPY=/usr/bin/mysqlhotcopy
 # MYSQLDUMP=/usr/bin/mysqldump
index 25cd26e0569892df9349e0670568382eb5ef1e8b..5ad700be624eb014e23c4d05c407054a8602afa9 100644 (file)
 ## default is yes. set to no to skip the test if the remote host is alive
 # testconnect = no
 
+## default is not to limit bandwidth. 
+## set to a number in bytes/second to limit bandwidth usage. Use a negative 
+## number to set a limit that will never be exceeded, or a positive number 
+## to set a target average bandwidth use. cstream is required. See cstream's 
+## -t option for more information. 62500 bytes = 500 Kb (.5 Mb)
+# bwlimit = 62500
+
 ######################################################
 ## source section
 ## (where the files to be backed up are coming from)
index bdc1cbd25ddc7eb3b4916eea96794bfd57873db1..5561435331d6c0dab76e2f66678d52cd00309585 100644 (file)
@@ -64,11 +64,19 @@ function check_consistency() {
        fi
 }
 
+function check_cstream() {
+       local cstream=$1
+       if [ ! -x $cstream ]; then
+               fatal "Can't find your cstream binary (trying: $cstream). If you use bwlimit you must have cstream installed."
+       fi
+}
+
 ### GET CONFIG ###
 
 getconf options
 getconf testconnect yes
 getconf nicelevel 0
+getconf bwlimit
 
 setsection source
 getconf type; sourcetype=$type
@@ -167,6 +175,19 @@ if [ $test = 0 ]; then
        fi
 fi
 
+# Add cstream 
+
+if [ ! -z $bwlimit ]; then
+       check_cstream $CSTREAM;
+       if [ "$desttype" = "remote" ]; then
+               RDIFFBACKUP="$RDIFFBACKUP --remote-schema 'cstream -t $bwlimit | ssh %s \''rdiff-backup --server\'''"
+       elif [ "$sourcetype" = "remote" ]; then
+               RDIFFBACKUP="$RDIFFBACKUP --remote-schema 'ssh %s \''rdiff-backup --server\'' | cstream -t $bwlimit'"
+       else
+               fatal "You specified a bandwidth limit but neither your source nor destination types are remote."
+       fi
+fi
+
 ### EXECUTE ###
 
 execstr="$RDIFFBACKUP $options --print-statistics "
index 7430176f306a5a5cbde29eaab2099ac38a5a2889..6295198761c3018ceb4add8fdba08d9faf1c02ba 100755 (executable)
@@ -445,6 +445,7 @@ getconf usecolors "yes"
 getconf SLAPCAT /usr/sbin/slapcat
 getconf LDAPSEARCH /usr/bin/ldapsearch
 getconf RDIFFBACKUP /usr/bin/rdiff-backup
+getconf CSTREAM=/usr/bin/cstream
 getconf MYSQLADMIN /usr/bin/mysqladmin
 getconf MYSQL /usr/bin/mysql
 getconf MYSQLHOTCOPY /usr/bin/mysqlhotcopy