X-Git-Url: http://git.pippins.net/embedvideo/.git/?a=blobdiff_plain;f=zfs-replicate;h=09cb3babb7600f0526a14b4b2c2f945f41660ea4;hb=984d48e66a916fd9ba533ae19b43aafd449dad77;hp=dc6dab215c592241685f6f90eb017ab4e6f85ded;hpb=028d60e078bc5fe362314a86c3436255e7020dd4;p=zfs-ubuntu%2F.git diff --git a/zfs-replicate b/zfs-replicate index dc6dab2..09cb3ba 100755 --- a/zfs-replicate +++ b/zfs-replicate @@ -10,7 +10,7 @@ remote_lockdir="/tmp/zfs-admin-lock" 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. @@ -19,6 +19,14 @@ destroy_local_filesystem_on_full_replicate=0 # 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 " @@ -78,10 +86,6 @@ while true; do 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}