local_pool=backups
# Set the email address to send notification to
-mailto=alan@pippins.net
+mailto=root@pippins.net
# When this variable is set, local filesystems will be destroyed
# before receiving a full streams into them from the remote source.
# The ssh connection doesn't find zfs without this.
zfs=/usr/sbin/zfs
+# Setup our cleanup and exit trap
+cleanup() {
+ ssh $remote rm -rf "$remote_lockdir"
+ exit
+}
+trap cleanup INT
+trap cleanup EXIT
+
# Make sure we have valid arguments
if [[ -z "$remote" ]] || [[ -z "$remote_fs" ]]; then
echo "Usage: $0 <hostname> <zfs filesystem>"
fi
done
-# Declare a cleanup() method to remove the remote lockdir
-cleanup() { ssh $remote rm -rf "$remote_lockdir"; }
-trap cleanup EXIT
-
# Setup our backup marker names
current_backup_marker=${remote_fs}@current-backup-${local_pool_guid}
previous_backup_marker=${remote_fs}@previous-backup-${local_pool_guid}