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