+ msgs=`cat $tmpfile`
+ fatal_and_exit "-E- The local backup pool on $hostname, '$backup_pool' doesn't seem to exist: $msgs" "$mailto"
+ fi
+fi
+rm -f $tmpfile
+
+# Obtain the zpool guid for the local backup pool
+backup_pool_guid=`zpool get guid $backup_pool 2>&1 | grep $backup_pool | awk '{ print $3 }'`
+zpool get guid $backup_pool > /dev/null 2>&1
+if [ $? != 0 ]; then
+ fatal_and_exit "-E- Unable to extract the guid for the local backup pool on $hostname: $backup_pool" "$mailto"
+fi
+
+# Setup our backup marker names
+current_backup_marker=@current-backup-${backup_pool_guid}
+previous_backup_marker=@previous-backup-${backup_pool_guid}
+
+# Sort the filesystems to replicate by the oldest backup first
+for filesystem in $filesystems_to_replicate; do
+ if [[ $filesystem =~ ':' ]]; then
+ dst_pool=${filesystem%%:*}
+ filesystem=${filesystem#*:} # remove src_pool from string
+ else
+ dst_pool=$backup_pool
+ fi
+ # Only backup filesystems that are specified to go this backup_pool
+ if [[ $backup_pool == $dst_pool ]]; then
+ age=`snapshot_age $filesystem`
+ echo $filesystem $age >> $tmpfile