author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 22 Oct 2006 16:32:58 +0000 (18:32 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 22 Oct 2006 16:32:58 +0000 (18:32 +0200) |
src/collectd.c | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history | |
src/collectd.pod | patch | blob | history |
diff --git a/src/collectd.c b/src/collectd.c
index 0d9c90fce19a5dd2fe1e222c8a61f3d07e63a67d..98b9a1623f77b8840e6dbf36dbd7cfa4c69b2f1e 100644 (file)
--- a/src/collectd.c
+++ b/src/collectd.c
" General:\n"
" -C <file> Configuration file.\n"
" Default: "CONFIGFILE"\n"
+ " -P <file> PID-file.\n"
+ " Default: "PIDFILE"\n"
#if COLLECT_DAEMON
" -f Don't fork to the background.\n"
#endif
char *configfile = CONFIGFILE;
#if COLLECT_DAEMON
struct sigaction sigChldAction;
- char *pidfile = PIDFILE;
+ char *pidfile = NULL;
pid_t pid;
int daemonize = 1;
#endif
c = getopt (argc, argv, "hC:"
#if COLLECT_DAEMON
- "f"
+ "fP:"
#endif
);
configfile = optarg;
break;
#if COLLECT_DAEMON
+ case 'P':
+ pidfile = optarg;
+ break;
case 'f':
daemonize = 0;
break;
sigChldAction.sa_handler = SIG_IGN;
sigaction (SIGCHLD, &sigChldAction, NULL);
- if ((pidfile = cf_get_option ("PIDFile", PIDFILE)) == NULL)
+ if ((pidfile == NULL)
+ && ((pidfile = cf_get_option ("PIDFile", PIDFILE)) == NULL))
{
fprintf (stderr, "Cannot obtain pidfile. This shoud not happen. Ever.");
return (1);
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index f3e2585659504f26af3d335bf37e0bacf659726d..7e4b858e84b09ad0db0a2fee0d7b225af3dd0a04 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
=item B<PIDFile> I<File>
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<all modes>.
+and deleted when the program ist stopped. Some init-scripts might override this
+setting using the B<-P> commandline option. Available in B<all modes>.
=item B<DataDir> I<Directory>
diff --git a/src/collectd.pod b/src/collectd.pod
index 26185eea444e63d6ab09f9ce6e74874a9534f50d..0e1adc50c6f1c3e9a9e772bab1458936cdf135f2 100644 (file)
--- a/src/collectd.pod
+++ b/src/collectd.pod
change B<collectd>'s behavior. The path may be relative to the current working
directory.
+=item B<-P> I<E<lt>pid-fileE<gt>>
+
+Specify an alternative pid file. This overwrites any settings in the config
+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<PIDFile>
+config-option.
+
=item B<-f>
Don't fork to the background. I<collectd> will also B<not> close standard file