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
# 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
## 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)
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
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 "
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