From a8cc4091804b62f530c9b4f21e91eb7d5277cc7c Mon Sep 17 00:00:00 2001 From: Otho Date: Mon, 16 Jan 2023 22:55:02 -0500 Subject: [PATCH] Improved some command formats. --- backup.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backup.sh b/backup.sh index 760e9fd..e64e598 100755 --- a/backup.sh +++ b/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