aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------grecs0
-rw-r--r--src/cmdline.opt6
-rw-r--r--src/config.c9
-rw-r--r--src/nssync.c4
4 files changed, 13 insertions, 6 deletions
diff --git a/grecs b/grecs
Subproject 6020d6243c7fdf657da768b3fb2efa1244665d5 Subproject 3299cf1ccb1c596969fcfd91253e10d5482eacf
diff --git a/src/cmdline.opt b/src/cmdline.opt
index 221133e..23c6bcb 100644
--- a/src/cmdline.opt
+++ b/src/cmdline.opt
@@ -58,12 +58,18 @@ END
58OPTION(config-file,c,FILE, 58OPTION(config-file,c,FILE,
59 [<use FILE instead of the default configuration>]) 59 [<use FILE instead of the default configuration>])
60BEGIN 60BEGIN
61 config_file = optarg; 61 config_file = optarg;
62END 62END
63 63
64OPTION(pidfile,p,FILE,
65 [<write PID to FILE>])
66BEGIN
67 cli_pidfile = optarg;
68END
69
64OPTION(cron,,, 70OPTION(cron,,,
65 [<run as a periodic cron job (default)>]) 71 [<run as a periodic cron job (default)>])
66BEGIN 72BEGIN
67 server_mode = 0; 73 server_mode = 0;
68END 74END
69 75
diff --git a/src/config.c b/src/config.c
index 5ff9280..6ddb2ea 100644
--- a/src/config.c
+++ b/src/config.c
@@ -385,36 +385,33 @@ synclist_fixup()
385 return err; 385 return err;
386} 386}
387 387
388void 388void
389config_parse() 389config_parse()
390{ 390{
391 int err = 0;
392 struct grecs_node *tree = grecs_parse(config_file); 391 struct grecs_node *tree = grecs_parse(config_file);
393 if (!tree) 392 if (!tree)
394 exit(EX_CONFIG); 393 exit(EX_CONFIG);
395 grecs_tree_reduce(tree, nssync_kw, GRECS_AGGR); 394 grecs_tree_reduce(tree, nssync_kw, GRECS_AGGR);
396 if (grecs_tree_process(tree, nssync_kw)) 395 if (grecs_tree_process(tree, nssync_kw))
397 exit(EX_CONFIG); 396 exit(EX_CONFIG);
398 grecs_tree_free(tree); 397 grecs_tree_free(tree);
399 398
400 if (!synclist) { 399 if (!synclist) {
401 error("nothing to do!"); 400 error("nothing to do!");
402 err = 1; 401 exit(EX_CONFIG);
403 } 402 }
404 403
405 if (synclist_fixup()) 404 if (synclist_fixup())
406 err = 1; 405 exit(EX_CONFIG);
407 406
408 if (sql_host_fixup()) 407 if (sql_host_fixup())
409 err = 1; 408 exit(EX_CONFIG);
410 409
411 source_named_conf(); 410 source_named_conf();
412 411
413 if (err)
414 exit(EX_CONFIG);
415 if (lint_mode) 412 if (lint_mode)
416 exit(0); 413 exit(0);
417 if (!tempdir) { 414 if (!tempdir) {
418 tempdir = getenv("TMP"); 415 tempdir = getenv("TMP");
419 if (!tempdir) 416 if (!tempdir)
420 tempdir = "/tmp"; 417 tempdir = "/tmp";
diff --git a/src/nssync.c b/src/nssync.c
index d10ce05..8f4fad2 100644
--- a/src/nssync.c
+++ b/src/nssync.c
@@ -27,12 +27,13 @@ int lint_mode;
27int dry_run_mode; 27int dry_run_mode;
28int preprocess_only; 28int preprocess_only;
29int debug_level; 29int debug_level;
30char *config_file = SYSCONFDIR "/nssync.conf"; 30char *config_file = SYSCONFDIR "/nssync.conf";
31char *slave_status_file; 31char *slave_status_file;
32char *pidfile; 32char *pidfile;
33char *cli_pidfile;
33int force; 34int force;
34char *tempdir; 35char *tempdir;
35char *reload_command = "/usr/sbin/rndc reload"; 36char *reload_command = "/usr/sbin/rndc reload";
36struct json_value *error_list; 37struct json_value *error_list;
37struct json_value *changed_zones; 38struct json_value *changed_zones;
38int check_ns; 39int check_ns;
@@ -699,12 +700,15 @@ main(int argc, char **argv)
699 parse_options(argc, argv); 700 parse_options(argc, argv);
700 if (preprocess_only) 701 if (preprocess_only)
701 exit(grecs_preproc_run(config_file, grecs_preprocessor) ? 702 exit(grecs_preproc_run(config_file, grecs_preprocessor) ?
702 EX_CONFIG : 0); 703 EX_CONFIG : 0);
703 config_parse(); 704 config_parse();
704 705
706 if (cli_pidfile)
707 pidfile = cli_pidfile;
708
705 check_pidfile(); 709 check_pidfile();
706 710
707 if (check_ns) 711 if (check_ns)
708 get_host_addresses(); 712 get_host_addresses();
709 713
710 if (server_mode) { 714 if (server_mode) {

Return to:

Send suggestions and report system problems to the System administrator.