write pid after daemonize()

This commit is contained in:
Axel Kittenberger 2011-01-12 15:48:50 +00:00
parent e4d815b770
commit 50c133ff73

View File

@ -1120,9 +1120,6 @@ l_configure(lua_State *L)
* from this on log to configurated log end instead of * from this on log to configurated log end instead of
* stdout/stderr */ * stdout/stderr */
running = true; running = true;
if (settings.pidfile) {
write_pidfile(L, settings.pidfile);
}
if (!settings.nodaemon && !is_daemon) { if (!settings.nodaemon && !is_daemon) {
if (!settings.log_file) { if (!settings.log_file) {
settings.log_syslog = true; settings.log_syslog = true;
@ -1130,6 +1127,9 @@ l_configure(lua_State *L)
logstring("Debug", "daemonizing now."); logstring("Debug", "daemonizing now.");
daemonize(L); daemonize(L);
} }
if (settings.pidfile) {
write_pidfile(L, settings.pidfile);
}
} else if (!strcmp(command, "nodaemon")) { } else if (!strcmp(command, "nodaemon")) {
settings.nodaemon = true; settings.nodaemon = true;
} else if (!strcmp(command, "logfile")) { } else if (!strcmp(command, "logfile")) {