fatal_and_exit "-E- remote incremental $zfs rollback command failed" $mailto
fi
# Now it should be safe to send the snaps
- ssh $remote $zfs send -R -I${previous_backup_marker} ${current_backup_marker} |
- $zfs receive -vF -d ${local_pool}/${remote_pool}
+ if [[ $throttle_enable == 1 && -e $throttle ]]; then
+ ssh $remote $zfs send -R -I${previous_backup_marker} ${current_backup_marker} |
+ $throttle $throttle_opts | $zfs receive -vF -d ${local_pool}/${remote_pool}
+ else
+ ssh $remote $zfs send -R -I${previous_backup_marker} ${current_backup_marker} |
+ $zfs receive -vF -d ${local_pool}/${remote_pool}
+ fi
if [ $? != 0 ]; then
fatal_and_exit "-E- remote incremental $zfs send command failed" $mailto
fi
if [[ -n "$common" ]]; then
# We found a common snapshot, incrementally send the new snaps
- ssh $remote $zfs send -R -I${common/*@/@} ${current_backup_marker} |
- $zfs receive -vF -d ${local_pool}/${remote_pool}
+ if [[ $throttle_enable == 1 && -e $throttle ]]; then
+ ssh $remote $zfs send -R -I${common/*@/@} ${current_backup_marker} |
+ $throttle $throttle_opts | $zfs receive -vF -d ${local_pool}/${remote_pool}
+ else
+ ssh $remote $zfs send -R -I${common/*@/@} ${current_backup_marker} |
+ $zfs receive -vF -d ${local_pool}/${remote_pool}
+ fi
if [ $? != 0 ]; then
fatal_and_exit "-E- remote incremental $zfs send command failed" $mailto
fi
fi
fi
# Send the full filesystem
- ssh $remote $zfs send -R ${current_backup_marker} |
- $zfs receive -vF -d ${local_pool}/${remote_pool}
+ if [[ $throttle_enable == 1 && -e $throttle ]]; then
+ ssh $remote $zfs send -R ${current_backup_marker} |
+ $throttle $throttle_opts | $zfs receive -vF -d ${local_pool}/${remote_pool}
+ else
+ ssh $remote $zfs send -R ${current_backup_marker} |
+ $zfs receive -vF -d ${local_pool}/${remote_pool}
+ fi
if [ $? != 0 ]; then
fatal_and_exit "-E- remote full $zfs send command failed" $mailto
fi
# Specify the maximum run time in minutes that the replicate script can run for (0=no limit)
maxruntime=0
+# Setup throttling related parameters that will rate limit the zfs send | zfs receive pipe
+throttle_enable=1
+throttle_opt="-M 5"
+throttle=/usr/local/bin/throttle
+
# Specify the list of filesystems to replicate from the remote to the local_pool (1 per line)
# (enter 1 filesystem per line)
filesystems_to_replicate='