]> git.cworth.org Git - sup/blobdiff - bin/sup
Merge commit 'c45207/shutdown-hook' into next
[sup] / bin / sup
diff --git a/bin/sup b/bin/sup
index b5b41ca93f6f1848a7f07dbe79d274f7f933efff..152c42c06aa3329a4c51b814d1b03e057bb68e03 100644 (file)
--- a/bin/sup
+++ b/bin/sup
@@ -45,6 +45,14 @@ No variables.
 No return value.
 EOS
 
+Redwood::HookManager.register "shutdown", <<EOS 
+Executes when sup is shutting down. May be run when sup is crashing,
+so don\'t do anything too important. Run before the label, contacts,
+and people are saved.
+No variables.
+No return value.
+EOS
+
 if $opts[:list_hooks]
   Redwood::HookManager.print_hooks
   exit
@@ -276,6 +284,8 @@ ensure
     Index.stop_lock_update_thread
   end
 
+  HookManager.run "shutdown"
+
   Redwood::finish
   stop_cursing
   Redwood::log "stopped cursing"