mod_posix: Catch SIGINT
authorMatthew Wild <mwild1@gmail.com>
Mon, 7 Dec 2009 18:38:35 +0000 (18:38 +0000)
committerMatthew Wild <mwild1@gmail.com>
Mon, 7 Dec 2009 18:38:35 +0000 (18:38 +0000)
plugins/mod_posix.lua

index b75b9610a887d9a5118ae77fdf8f39739147d3cc..697930cab39266e11bc9f0cb5ae07399ad09822a 100644 (file)
@@ -146,4 +146,11 @@ if signal.signal then
                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