Comparison

plugins/mod_posix.lua @ 5178:fa6d61f2fe20

Merge 0.9 -> trunk
author Kim Alvefur <zash@zash.se>
date Sun, 11 Nov 2012 23:48:38 +0100
parent 5177:add9ad38208e
child 5450:cc83b1a50fde
comparison
equal deleted inserted replaced
5174:42765c80244c 5178:fa6d61f2fe20
134 module:log("warn", "The 'no_daemonize' option is now replaced by 'daemonize'"); 134 module:log("warn", "The 'no_daemonize' option is now replaced by 'daemonize'");
135 module:log("warn", "Update your config from 'no_daemonize = %s' to 'daemonize = %s'", tostring(no_daemonize), tostring(daemonize)); 135 module:log("warn", "Update your config from 'no_daemonize = %s' to 'daemonize = %s'", tostring(no_daemonize), tostring(daemonize));
136 end 136 end
137 end 137 end
138 138
139 local function remove_log_sinks()
140 local lm = require "core.loggingmanager";
141 lm.register_sink_type("console", nil);
142 lm.register_sink_type("stdout", nil);
143 lm.reload_logging();
144 end
145
139 if daemonize then 146 if daemonize then
140 local function daemonize_server() 147 local function daemonize_server()
148 module:log("info", "Prosody is about to detach from the console, disabling further console output");
149 remove_log_sinks();
141 local ok, ret = pposix.daemonize(); 150 local ok, ret = pposix.daemonize();
142 if not ok then 151 if not ok then
143 module:log("error", "Failed to daemonize: %s", ret); 152 module:log("error", "Failed to daemonize: %s", ret);
144 elseif ret and ret > 0 then 153 elseif ret and ret > 0 then
145 os.exit(0); 154 os.exit(0);