X-Git-Url: http://git.pippins.net/embedvideo/.git/static/gitweb.js?a=blobdiff_plain;f=zfs-restore;h=d5ca2e6caeb9e079d1562e217fa3199b617f09fc;hb=9abe0a87af0eedf581b9fae58fd1c62974ca004b;hp=84de61e697ee9f5e4b0b93ba43cc2335aa8c53b8;hpb=cc81a4f1a8387e6991eb447383cae05220a65d15;p=zfs-ubuntu%2F.git diff --git a/zfs-restore b/zfs-restore index 84de61e..d5ca2e6 100755 --- a/zfs-restore +++ b/zfs-restore @@ -16,6 +16,9 @@ dst_pool=$3 dst_fs=$4 dst_hostname=$5 +# return non-zero exit code if any command in the pipe fails +set -o pipefail + if [[ -z "$SCRIPT_UNDER_TEST" ]]; then exec >> $logdir/zfs-restore.log 2>&1 fi @@ -54,7 +57,7 @@ fi src_pool_guid=`zpool get guid $src_pool 2>&1 | grep $src_pool | awk '{ print $3 }'` zpool get guid $src_pool > /dev/null 2>&1 if [ $? != 0 ]; then - fatal_and_exit "-E- Unable to extract the guid for the src pool: $src_pool" $mailto + fatal_and_exit "-E- Unable to extract the guid for the src pool on $hostname: $src_pool" $mailto fi # Setup our backup marker names @@ -80,12 +83,12 @@ fi # Now send the src filesystem if [[ -n "$SCRIPT_UNDER_TEST" ]]; then - echo "$zfs send -R $src_pool/$last_backup_marker | $ssh $dst_hostname $zfs recv -dv $dst_pool" + echo "$zfs send -Rc $src_pool/$last_backup_marker | $ssh $dst_hostname $zfs recv -dv $dst_pool" else if [[ $throttle_enable == 1 && -e $throttle ]]; then - $zfs send -R "$src_pool/$last_backup_marker" | $throttle $throttle_opt | $ssh $dst_hostname $zfs recv -dv $dst_pool + $zfs send -Rc "$src_pool/$last_backup_marker" | $throttle $throttle_opt | $ssh $dst_hostname $zfs recv -dv $dst_pool else - $zfs send -R "$src_pool/$last_backup_marker" | $ssh $dst_hostname $zfs recv -dv $dst_pool + $zfs send -Rc "$src_pool/$last_backup_marker" | $ssh $dst_hostname $zfs recv -dv $dst_pool fi fi