From b8a2489b12afeaf8039b0222bfdf7c5bc18dcf3c Mon Sep 17 00:00:00 2001
From: "Alan J. Pippin" <ajp@pippins.net>
Date: Tue, 18 Mar 2014 20:28:15 -0600
Subject: [PATCH] Fixed bug in running throttle command on remote machine
 instead of local

---
 zfs-replicate | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/zfs-replicate b/zfs-replicate
index b0241e8..1455061 100755
--- a/zfs-replicate
+++ b/zfs-replicate
@@ -181,8 +181,8 @@ if [ $no_markers == 0 ]; then
   fi
   # Now it should be safe to send the snaps
   if [[ $throttle_enable == 1 && -e $throttle ]]; then
-    $ssh $remote $zfs send -R -I${previous_backup_marker} ${current_backup_marker} | 
-        $throttle $throttle_opt | $zfs receive -vF -d ${backup_pool}/${remote_pool}
+    $ssh $remote "$zfs send -R -I${previous_backup_marker} ${current_backup_marker} | 
+        $throttle $throttle_opt" | $zfs receive -vF -d ${backup_pool}/${remote_pool}
   else 
     $ssh $remote $zfs send -R -I${previous_backup_marker} ${current_backup_marker} |
         $zfs receive -vF -d ${backup_pool}/${remote_pool}
@@ -206,8 +206,8 @@ else
   if [[ -n "$common" ]]; then
     # We found a common snapshot, incrementally send the new snaps
     if [[ $throttle_enable == 1 && -e $throttle ]]; then
-      $ssh $remote $zfs send -R -I${common/*@/@} ${current_backup_marker} |
-          $throttle $throttle_opt | $zfs receive -vF -d ${backup_pool}/${remote_pool}
+      $ssh $remote "$zfs send -R -I${common/*@/@} ${current_backup_marker} |
+          $throttle $throttle_opt" | $zfs receive -vF -d ${backup_pool}/${remote_pool}
     else
       $ssh $remote $zfs send -R -I${common/*@/@} ${current_backup_marker} |
           $zfs receive -vF -d ${backup_pool}/${remote_pool}
@@ -234,8 +234,8 @@ else
     fi
     # Send the full filesystem
     if [[ $throttle_enable == 1 && -e $throttle ]]; then
-      $ssh $remote $zfs send -R ${current_backup_marker} |
-          $throttle $throttle_opt | $zfs receive -vF -d ${backup_pool}/${remote_pool}
+      $ssh $remote "$zfs send -R ${current_backup_marker} |
+          $throttle $throttle_opt" | $zfs receive -vF -d ${backup_pool}/${remote_pool}
     else
       $ssh $remote $zfs send -R ${current_backup_marker} |
           $zfs receive -vF -d ${backup_pool}/${remote_pool}
-- 
2.34.1