grep ^${backup_pool}/${remote_fs}@ |
grep -v ^${backup_pool}/${current_backup_marker} |
awk "{gsub(/^$backup_pool./,\"\",\$1); print\$1}" > $local_list
-if [ $? != 0 ]; then
+if [[ $? != 0 ]] && [[ $expect_empty_remote_list == 0 ]]; then
fatal_and_exit "-E- local $zfs list on $hostname command failed" $mailto
fi
# import backup pool before replication and export backup pool after replication
import_export_backup_pool=0
+# expect empty remote list
+# - set to 1 if backing up any new filesystems for the first time
+# - set to 0 if not backing up new filesystems for the first time (to prevent dropping the entire filesystem if the remote list command fails)
+expect_empty_remote_list=0
+
# when this variable is set, local filesystems will be destroyed
# before receiving a full streams into them from the remote source.
# if it needs to do this, and this option is set to 0, it aborts.