mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 13:45:04 +02:00
parent
6bf47fd221
commit
ec903058ef
@ -185,7 +185,7 @@ static bool Daemonize(void)
|
|||||||
} while (readpid != pid && ret == 0);
|
} while (readpid != pid && ret == 0);
|
||||||
|
|
||||||
if (ret == pid) {
|
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);
|
exit(EXIT_FAILURE);
|
||||||
} else if (ret == -1) {
|
} else if (ret == -1) {
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
@ -546,13 +546,6 @@ int Main(void)
|
|||||||
return EXIT_FAILURE;
|
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()
|
// 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.");
|
Log(LogCritical, "icinga-app", "Error activating configuration.");
|
||||||
return EXIT_FAILURE;
|
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
|
#ifndef _WIN32
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user