mirror of
https://asciireactor.com/o4data/zfs-backup.git
synced 2024-11-21 23:05:06 +00:00
Added bandwidth limiter.
This commit is contained in:
parent
706aab7d4f
commit
4da22952cb
25
backup.sh
25
backup.sh
@ -21,6 +21,7 @@ ZFS_SEND_OPTS="-vpRLe"
|
||||
ZFS_SNAPSHOT_OPTS="-r"
|
||||
ZFS_RECV_OPTS="-svu"
|
||||
SSH_SEND_OPTS="-Ti ~/.ssh/id_rsa"
|
||||
BANDWIDTH_LIMIT="100M"
|
||||
|
||||
read LOCAL_HOST LOCAL_USER LOCAL_PORT LOCAL_TZ SEND_COMPRESSED < $nodes_file
|
||||
case $SEND_COMPRESSED in
|
||||
@ -163,13 +164,15 @@ send_latest()
|
||||
origin_snapshot=`get_latest_snapshot $dataset`
|
||||
if [ $BG_TEST_MODE = "TRUE" ]; then
|
||||
echo zfs send $ZFS_SEND_OPTS $dataset@$origin_snapshot \| \
|
||||
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
|
||||
zfs recv $ZFS_RECV_OPTS $zroot$dataset
|
||||
pv -qL $BANDWIDTH_LIMIT \| \
|
||||
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
|
||||
zfs recv $ZFS_RECV_OPTS $zroot$dataset
|
||||
else
|
||||
zfs send $ZFS_SEND_OPTS $dataset@$origin_snapshot |
|
||||
ssh $SSH_SEND_OPTS -o port=$ssh_port \
|
||||
$user@$addr \
|
||||
zfs recv $ZFS_RECV_OPTS $zroot$dataset
|
||||
pv -qL $BANDWIDTH_LIMIT |
|
||||
ssh $SSH_SEND_OPTS -o port=$ssh_port \
|
||||
$user@$addr \
|
||||
zfs recv $ZFS_RECV_OPTS $zroot$dataset
|
||||
fi
|
||||
done
|
||||
done < sendnodes.tmp
|
||||
@ -192,14 +195,16 @@ send_increment()
|
||||
echo zfs send $ZFS_SEND_OPTS \
|
||||
-i $dataset@$remote_snapshot \
|
||||
$dataset@$origin_snapshot \| \
|
||||
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
|
||||
zfs recv $ZFS_RECV_OPTS $zroot$dataset
|
||||
pv -qL $BANDWIDTH_LIMIT \| \
|
||||
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
|
||||
zfs recv $ZFS_RECV_OPTS $zroot$dataset
|
||||
else
|
||||
zfs send $ZFS_SEND_OPTS \
|
||||
-i $dataset@$remote_snapshot \
|
||||
$dataset@$origin_snapshot |
|
||||
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
|
||||
zfs recv $ZFS_RECV_OPTS $zroot$dataset
|
||||
$dataset@$origin_snapshot |
|
||||
pv -qL $BANDWIDTH_LIMIT |
|
||||
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
|
||||
zfs recv $ZFS_RECV_OPTS $zroot$dataset
|
||||
fi
|
||||
done
|
||||
done < sendnodes.tmp
|
||||
|
Loading…
Reference in New Issue
Block a user