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
OPTION(config-file,c,FILE,
[<use FILE instead of the default configuration>])
BEGIN
config_file = optarg;
END
+OPTION(pidfile,p,FILE,
+ [<write PID to FILE>])
+BEGIN
+ cli_pidfile = optarg;
+END
+
OPTION(cron,,,
[<run as a periodic cron job (default)>])
BEGIN
server_mode = 0;
END
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()
return err;
}
void
config_parse()
{
- int err = 0;
struct grecs_node *tree = grecs_parse(config_file);
if (!tree)
exit(EX_CONFIG);
grecs_tree_reduce(tree, nssync_kw, GRECS_AGGR);
if (grecs_tree_process(tree, nssync_kw))
exit(EX_CONFIG);
grecs_tree_free(tree);
if (!synclist) {
error("nothing to do!");
- err = 1;
+ exit(EX_CONFIG);
}
if (synclist_fixup())
- err = 1;
+ exit(EX_CONFIG);
if (sql_host_fixup())
- err = 1;
+ exit(EX_CONFIG);
source_named_conf();
- if (err)
- exit(EX_CONFIG);
if (lint_mode)
exit(0);
if (!tempdir) {
tempdir = getenv("TMP");
if (!tempdir)
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;
int dry_run_mode;
int preprocess_only;
int debug_level;
char *config_file = SYSCONFDIR "/nssync.conf";
char *slave_status_file;
char *pidfile;
+char *cli_pidfile;
int force;
char *tempdir;
char *reload_command = "/usr/sbin/rndc reload";
struct json_value *error_list;
struct json_value *changed_zones;
int check_ns;
@@ -699,12 +700,15 @@ main(int argc, char **argv)
parse_options(argc, argv);
if (preprocess_only)
exit(grecs_preproc_run(config_file, grecs_preprocessor) ?
EX_CONFIG : 0);
config_parse();
+ if (cli_pidfile)
+ pidfile = cli_pidfile;
+
check_pidfile();
if (check_ns)
get_host_addresses();
if (server_mode) {

Return to:

Send suggestions and report system problems to the System administrator.