From 80e5913b92d256486d08d966ab2fa34d2d6046fb Mon Sep 17 00:00:00 2001 From: "Alan J. Pippin" Date: Mon, 12 Jan 2009 20:49:21 -0700 Subject: [PATCH] Added code to deal with not finding a common snapshot --- zfs-replicate | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/zfs-replicate b/zfs-replicate index 7f93696..7c6e650 100755 --- a/zfs-replicate +++ b/zfs-replicate @@ -33,7 +33,14 @@ echo bogus.remote >> $remote_list echo bogus.local >> $local_list common=$(diff -u $remote_list $local_list | grep '^ ' | tail -n 1) -ssh $remote $zfs send -R -I${common/*@/@} $latest | - $zfs receive -vF -d ${local_pool}/${remote_fs%/*} +if [ -n "$common" ]; then + # We found a common snapshot + ssh $remote $zfs send -R -I${common/*@/@} $latest | + $zfs receive -vF -d ${local_pool}/${remote_fs%/*} +else + # We did not find a common snapshot, so send the entire filesystem + ssh $remote $zfs send -R $latest | + $zfs receive -vF -d ${local_pool}/${remote_fs%/*} +endif rm -f $local_list $remote_list -- 2.34.1