mod_posix: Catch SIGINT

Mon, 07 Dec 2009 18:38:35 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 07 Dec 2009 18:38:35 +0000
changeset 2332
7772dde4010b
parent 2331
4842ce0c3be4
child 2333
ed824115becf

mod_posix: Catch SIGINT

plugins/mod_posix.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_posix.lua	Mon Dec 07 18:32:50 2009 +0000
+++ b/plugins/mod_posix.lua	Mon Dec 07 18:38:35 2009 +0000
@@ -146,4 +146,11 @@
 		prosody.reload_config();
 		prosody.reopen_logfiles();
 	end);
+	
+	signal.signal("SIGINT", function ()
+		module:log("info", "Received SIGINT");
+		prosody.unlock_globals();
+		prosody.shutdown("Received SIGINT");
+		prosody.lock_globals();
+	end);
 end

mercurial