Comparison

plugins/mod_posix.lua @ 2073:72784ce0c0e0

mod_posix: Switch config option to 'daemonize', fall back to 'no_daemonize' if not set, default behaviour remains the same... daemonize if mod_posix is loaded
author Matthew Wild <mwild1@gmail.com>
date Sun, 08 Nov 2009 15:10:44 +0000
parent 1712:45a81d6d8777
child 2074:c59c8f3ec645
comparison
equal deleted inserted replaced
2072:464a5392bc80 2073:72784ce0c0e0
100 end 100 end
101 end; 101 end;
102 end 102 end
103 require "core.loggingmanager".register_sink_type("syslog", syslog_sink_maker); 103 require "core.loggingmanager".register_sink_type("syslog", syslog_sink_maker);
104 104
105 if not module:get_option("no_daemonize") then 105 local daemonize = module:get_option("daemonize");
106 if daemonize == nil then
107 daemonize = not module:get_option("no_daemonize"); --COMPAT w/ 0.5
108 end
109
110 if daemonize then
106 local function daemonize_server() 111 local function daemonize_server()
107 local ok, ret = pposix.daemonize(); 112 local ok, ret = pposix.daemonize();
108 if not ok then 113 if not ok then
109 module:log("error", "Failed to daemonize: %s", ret); 114 module:log("error", "Failed to daemonize: %s", ret);
110 elseif ret and ret > 0 then 115 elseif ret and ret > 0 then