X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=handlers%2Frdiff;h=5561435331d6c0dab76e2f66678d52cd00309585;hb=ca7f22b5251c4447e2ea2100d65b1a1cc987e677;hp=bdc1cbd25ddc7eb3b4916eea96794bfd57873db1;hpb=ac9caf890c33cc87b5df7b1fb7b1ffcdd2a6ce03;p=matthijs%2Fupstream%2Fbackupninja.git diff --git a/handlers/rdiff b/handlers/rdiff index bdc1cbd..5561435 100644 --- a/handlers/rdiff +++ b/handlers/rdiff @@ -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 "