X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_posix.lua;h=95b950347476292956d264e51bd2748f527e7a27;hb=04a2051ee150255ca12514016c0b451851c5c1ca;hp=5f7dfc5b1884e9c8b857b851c1aa43764b936c4f;hpb=b155bce5da7c12fe5c34366c1197978f49d34239;p=prosody.git diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua index 5f7dfc5b..95b95034 100644 --- a/plugins/mod_posix.lua +++ b/plugins/mod_posix.lua @@ -102,7 +102,17 @@ function syslog_sink_maker(config) end require "core.loggingmanager".register_sink_type("syslog", syslog_sink_maker); -if not module:get_option("no_daemonize") then +local daemonize = module:get_option("daemonize"); +if daemonize == nil then + local no_daemonize = module:get_option("no_daemonize"); --COMPAT w/ 0.5 + daemonize = not no_daemonize; + if no_daemonize ~= nil then + module:log("warn", "The 'no_daemonize' option is now replaced by 'daemonize'"); + module:log("warn", "Update your config from 'no_daemonize = %s' to 'daemonize = %s'", tostring(no_daemonize), tostring(daemonize)); + end +end + +if daemonize then local function daemonize_server() local ok, ret = pposix.daemonize(); if not ok then @@ -126,6 +136,7 @@ module:add_event_hook("server-stopped", remove_pidfile); if signal.signal then signal.signal("SIGTERM", function () module:log("warn", "Received SIGTERM"); + signal.signal("SIGTERM", function () end); -- Fixes us getting into some kind of loop prosody.unlock_globals(); prosody.shutdown("Received SIGTERM"); prosody.lock_globals(); @@ -136,4 +147,12 @@ if signal.signal then prosody.reload_config(); prosody.reopen_logfiles(); end); + + signal.signal("SIGINT", function () + module:log("info", "Received SIGINT"); + signal.signal("SIGINT", function () end); -- Fix to not loop + prosody.unlock_globals(); + prosody.shutdown("Received SIGINT"); + prosody.lock_globals(); + end); end