1 #include "opensrf/osrf_system.h"
8 @brief Run an OSRF server as defined by the command line and a config file.
9 @param argc Number of command line arguments, plus one.
10 @param argv Ragged array of command name plus command line arguments.
11 @return 0 if successful, or 1 if failure.
13 Command line parameters:
14 - Full network name of the host where the process is running; or 'localhost' will do.
15 - Name of the configuration file; normally '/openils/conf/opensrf_core.xml'.
16 - Name of an aggregate within the configuration file, containing the relevant subset
17 of configuration stuff.
19 int main( int argc, char* argv[] ) {
29 /* values must be strdup'ed because init_proc_title /
30 * set_proc_title are evil and overwrite the argv memory */
33 while ((c = getopt(argc, argv, "h:c:x:p:a:s:")) != -1) {
36 host = strdup(optarg);
39 config = strdup(optarg);
42 context = strdup(optarg);
45 piddir = strdup(optarg);
48 action = strdup(optarg);
51 service = strdup(optarg);
59 if (!(host && config && context && piddir && action)) {
60 fprintf(stderr, "Usage: %s -h <host> -c <config> "
61 "-x <config_context> -p <piddir>\n", argv[0]);
65 // prepare the proc title hack
66 init_proc_title(argc, argv);
68 // make sure the service name is valid
69 if (service && strlen(service) == 0) {
74 int ret = osrf_system_service_ctrl(
75 host, config, context, piddir, action, service);
80 "Server Loop returned an error condition, exiting with %d",
90 if (service) free(service);