- echo "-> Replicating $remote:$filesystem to ${local_pool}/${filesystem}" | tee -a $mylogfile
- replicate $remote $filesystem
+ echo "-> Replicating $remote:$filesystem to ${backup_pool}/${filesystem}" | tee -a $mylogfile
+ replicate $remote $filesystem $backup_pool
+done
+
+# Export the local pool if told to do so
+if [[ $import_export_backup_pool == 1 ]]; then
+ # Don't export the pool if there is a currently running zfs-scrub operation
+ ps -ef | grep "zfs-scrub" | grep -q "${backup_pool}" | grep -v grep
+ if [ $? != 0 ]; then
+ zpool export $backup_pool >> $tmpfile 2>&1
+ if [ $? != 0 ]; then
+ sleep 300
+ zpool export $backup_pool >> $tmpfile 2>&1
+ if [ $? != 0 ]; then
+ lsof /$backup_pool/* >> $tmpfile 2>&1
+ msgs=`cat $tmpfile`
+ fatal_and_exit "-E- unable to export the local backup pool $backup_pool on $hostname: $msgs" "$mailto" 0
+ fi
+ fi
+ fi
+fi
+rm -f $tmpfile
+