Changed cleanup() trap to be based on INT signal instead of EXIT
authorAlan J. Pippin <ajp@pippins.net>
Fri, 22 Aug 2008 13:34:29 +0000 (07:34 -0600)
committerAlan J. Pippin <ajp@pippins.net>
Fri, 22 Aug 2008 13:34:29 +0000 (07:34 -0600)
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

index b52e64e05e3ffbb7c8fb77a88af8756013ed61e3..5e4e44a6a1a71d152cced9d70005e39e60fa2181 100755 (executable)
@@ -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
+