- ret = start_http_listener();
- if (ret)
- return ret; /* error starting http listener */
-
- yaz_sc_running(s);
-
- yaz_daemon("pazpar2",
- (global_parameters.debug_mode ? YAZ_DAEMON_DEBUG : 0) +
- (daemon ? YAZ_DAEMON_FORK : 0) + YAZ_DAEMON_KEEPALIVE,
- child_handler, 0 /* child_data */,
- pidfile, uid);
- return 0;
+ config = config_create(config_fname);
+ if (!config)
+ return 1;
+ sc_stop_config = config;
+ ret = 0;
+ if (test_mode)
+ {
+ yaz_log(YLOG_LOG, "Configuration OK");
+ config_destroy(config);
+ }
+ else
+ {
+ if (daemon && !log_file_in_use)
+ {
+ yaz_log(YLOG_FATAL, "Logfile must be given (option -l) for daemon "
+ "mode");
+ ret = 1;
+ }
+ if (!ret)
+ ret = config_start_listeners(config, listener_override,
+ record_fname);
+ if (!ret)
+ {
+ yaz_sc_running(s);
+ yaz_daemon("pazpar2",
+ (global_parameters.debug_mode ? YAZ_DAEMON_DEBUG : 0) +
+ (daemon ? YAZ_DAEMON_FORK : 0) + YAZ_DAEMON_KEEPALIVE,
+ child_handler, config /* child_data */,
+ pidfile, uid);
+ }
+ yaz_log(YLOG_LOG, "Pazpar2 stop");
+ }
+ config_destroy(config);
+ return ret;