mirror of https://github.com/Icinga/icinga2.git
parent
6bf47fd221
commit
ec903058ef
|
@ -185,7 +185,7 @@ static bool Daemonize(void)
|
|||
} while (readpid != pid && ret == 0);
|
||||
|
||||
if (ret == pid) {
|
||||
Log(LogCritical, "icinga-app", "The daemon could not be started. See logfile for details.");
|
||||
Log(LogCritical, "icinga-app", "The daemon could not be started. See log output for details.");
|
||||
exit(EXIT_FAILURE);
|
||||
} else if (ret == -1) {
|
||||
std::ostringstream msgbuf;
|
||||
|
@ -546,13 +546,6 @@ int Main(void)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
String errorLog;
|
||||
if (g_AppParams.count("errorlog"))
|
||||
errorLog = g_AppParams["errorlog"].as<std::string>();
|
||||
|
||||
SetDaemonIO(errorLog);
|
||||
Logger::DisableConsoleLog();
|
||||
}
|
||||
|
||||
// activate config only after daemonization: it starts threads and that is not compatible with fork()
|
||||
|
@ -560,6 +553,15 @@ int Main(void)
|
|||
Log(LogCritical, "icinga-app", "Error activating configuration.");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (g_AppParams.count("daemonize")) {
|
||||
String errorLog;
|
||||
if (g_AppParams.count("errorlog"))
|
||||
errorLog = g_AppParams["errorlog"].as<std::string>();
|
||||
|
||||
SetDaemonIO(errorLog);
|
||||
Logger::DisableConsoleLog();
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
struct sigaction sa;
|
||||
|
|
Loading…
Reference in New Issue