mirror of
https://asciireactor.com/o4data/zfs-backup.git
synced 2024-11-24 04:15:06 +00:00
Improved some command formats.
This commit is contained in:
parent
cbf26b68bd
commit
a8cc409180
13
backup.sh
13
backup.sh
@ -41,10 +41,11 @@ debug()
|
||||
|
||||
run_send_recv()
|
||||
{
|
||||
ssh_cmd="ssh $SSH_SEND_OPTS -o port=$port $user@$addr"
|
||||
if [ $ZB_TEST_MODE = "TRUE" ]; then
|
||||
echo "$send_cmd | $pv_cmd | $recv_cmd"
|
||||
echo "$send_cmd | $pv_cmd | $ssh_cmd $recv_cmd"
|
||||
else
|
||||
$send_cmd | $pv_cmd | $recv_cmd
|
||||
$send_cmd | $pv_cmd | $ssh_cmd $recv_cmd
|
||||
fi
|
||||
}
|
||||
|
||||
@ -158,7 +159,8 @@ get_latest_remote_snapshot()
|
||||
*) zroot="$zroot/" ;;
|
||||
esac
|
||||
fi
|
||||
remote_cmd="zfs list -t snapshot $zroot$dset|tail -n1|cut -d'@' -f2|cut -d' ' -f 1"
|
||||
list_cmd="zfs list -t snapshot $zroot$dset"
|
||||
remote_cmd="$list_cmd|tail -n1|cut -d'@' -f2|cut -d' ' -f 1"
|
||||
run_remote
|
||||
|
||||
}
|
||||
@ -217,7 +219,7 @@ send_latest()
|
||||
snap1=`get_latest_snapshot $dset`
|
||||
send_cmd="zfs send $ZFS_SEND_OPTS $dset@$snap1"
|
||||
pv_cmd="pv -qL ${speed:-$DEF_SPEED}"
|
||||
recv_cmd="ssh $SSH_SEND_OPTS -o port=$port $user@$addr zfs recv $ZFS_RECV_OPTS $zroot$rset"
|
||||
recv_cmd="zfs recv $ZFS_RECV_OPTS $zroot$rset"
|
||||
run_send_recv
|
||||
done
|
||||
done < sendnodes.tmp
|
||||
@ -240,8 +242,7 @@ send_increment()
|
||||
snap0=`get_latest_remote_snapshot`
|
||||
send_cmd="zfs send $ZFS_SEND_OPTS -i $dset@$snap0 $dset@$snap1"
|
||||
pv_cmd="pv -qL ${speed:-$DEF_SPEED}"
|
||||
recv_cmd="ssh $SSH_SEND_OPTS -o port=$port $user@$addr \
|
||||
zfs recv $ZFS_RECV_OPTS $zroot$rset"
|
||||
recv_cmd="zfs recv $ZFS_RECV_OPTS $zroot$rset"
|
||||
run_send_recv
|
||||
done
|
||||
done < sendnodes.tmp
|
||||
|
Loading…
Reference in New Issue
Block a user