return false;
}
+ config->daemonize = false;
+
if (!fetch_config_int(lines, "num_servers", &config->num_servers)) {
log(ERROR, "Missing 'num_servers' statement in config file.");
return false;
if (!parse_error_log(line, config)) {
return false;
}
+ } else if (line.keyword == "daemonize") {
+ config->daemonize = true;
} else {
log(ERROR, "Unknown configuration keyword '%s'.",
line.keyword.c_str());
};
struct Config {
+ bool daemonize;
int num_servers;
std::vector<MarkPoolConfig> mark_pools;
std::vector<StreamConfig> streams;
+# uncomment to run in the background:
+# daemonize
+
num_servers 4 # one for each cpu
#
if (test_config) {
exit(0);
}
+
+ // Ideally we'd like to daemonize only when we've started up all threads etc.,
+ // but daemon() forks, which is not good in multithreaded software, so we'll
+ // have to do it here.
+ if (config.daemonize) {
+ if (daemon(0, 0) == -1) {
+ log_perror("daemon");
+ exit(1);
+ }
+ }
start:
// Open logs as soon as possible.