From: Florian Forster Date: Sun, 22 Oct 2006 16:31:48 +0000 (+0200) Subject: Completed the documentation of the new `-P' commandline option. X-Git-Tag: collectd-3.11.0~68^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2bdfc256b1445ac61845e20d0bfd01a26e0b845d;p=collectd.git Completed the documentation of the new `-P' commandline option. Additionally the `have_pidfile' variable was eliminated. --- diff --git a/src/collectd.c b/src/collectd.c index e069bfeb..98b9a162 100644 --- a/src/collectd.c +++ b/src/collectd.c @@ -123,6 +123,8 @@ static void exit_usage (char *name) " General:\n" " -C Configuration file.\n" " Default: "CONFIGFILE"\n" + " -P PID-file.\n" + " Default: "PIDFILE"\n" #if COLLECT_DAEMON " -f Don't fork to the background.\n" #endif @@ -281,8 +283,7 @@ int main (int argc, char **argv) char *configfile = CONFIGFILE; #if COLLECT_DAEMON struct sigaction sigChldAction; - char *pidfile = PIDFILE; - int have_pidfile = 0; + char *pidfile = NULL; pid_t pid; int daemonize = 1; #endif @@ -320,8 +321,7 @@ int main (int argc, char **argv) break; #if COLLECT_DAEMON case 'P': - pidfile = optarg; - have_pidfile = 1; + pidfile = optarg; break; case 'f': daemonize = 0; @@ -373,7 +373,7 @@ int main (int argc, char **argv) sigChldAction.sa_handler = SIG_IGN; sigaction (SIGCHLD, &sigChldAction, NULL); - if ((1 != have_pidfile) + if ((pidfile == NULL) && ((pidfile = cf_get_option ("PIDFile", PIDFILE)) == NULL)) { fprintf (stderr, "Cannot obtain pidfile. This shoud not happen. Ever."); diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index f3e25856..7e4b858e 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -49,7 +49,8 @@ will be mostly useless. The names of the plugins are listed in L. =item B I Sets where to write the PID file to. This file is overwritten when it exists -and deleted when the program ist stopped. Available in B. +and deleted when the program ist stopped. Some init-scripts might override this +setting using the B<-P> commandline option. Available in B. =item B I diff --git a/src/collectd.pod b/src/collectd.pod index 095463c1..0e1adc50 100644 --- a/src/collectd.pod +++ b/src/collectd.pod @@ -113,7 +113,9 @@ directory. =item B<-P> Ipid-fileE> Specify an alternative pid file. This overwrites any settings in the config -file. +file. This is thought for init-scripts that require the PID-file in a certain +directory to work correctly. For everyday-usage use the B +config-option. =item B<-f>