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
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();
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