From 9457c55171da10869ad028068935418208a576b0 Mon Sep 17 00:00:00 2001
From: "Alan J. Pippin" <ajp@pippins.net>
Date: Fri, 22 Aug 2008 07:34:29 -0600
Subject: [PATCH] Changed cleanup() trap to be based on INT signal instead of
 EXIT to prevent subsequent script instantiations from affecting the any that
 are currently running if they can't obtain the lock in a timely manner.

---
 zfs-replicate-wrapper | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/zfs-replicate-wrapper b/zfs-replicate-wrapper
index b52e64e..5e4e44a 100755
--- a/zfs-replicate-wrapper
+++ b/zfs-replicate-wrapper
@@ -24,8 +24,9 @@ cleanup() {
     /usr/local/etc/bin/usb-drive-power off
     echo `date` ZFS admin lock released >> $logfile
   fi
+  exit
 }
-trap cleanup EXIT
+trap cleanup INT
 
 # Auto snapshot every zfs filesystem on the system specified below
 echo "$date Polling for ZFS admin lock" >> $logfile
@@ -81,3 +82,6 @@ echo `date` ZFS admin lock released >> $logfile
 # Parse the log file and extract our backup stats
 $logfile_parser "$logfile" "$date" >> $logfile
 
+# clean things up and exit
+cleanup
+
-- 
2.34.1