summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ea985db)
raw | patch | inline | side by side (parent: ea985db)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 11 Oct 2006 21:03:42 +0000 (23:03 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 22 Oct 2006 16:12:22 +0000 (18:12 +0200) |
This option may be used to set the pid file, overwriting any settings found
in the config file.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
in the config file.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
src/collectd.c | patch | blob | history | |
src/collectd.pod | patch | blob | history |
diff --git a/src/collectd.c b/src/collectd.c
index 0d9c90fce19a5dd2fe1e222c8a61f3d07e63a67d..e069bfeb4ad95b394887aaa8a4ae500ef3343544 100644 (file)
--- a/src/collectd.c
+++ b/src/collectd.c
#if COLLECT_DAEMON
struct sigaction sigChldAction;
char *pidfile = PIDFILE;
+ int have_pidfile = 0;
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;
+ have_pidfile = 1;
+ break;
case 'f':
daemonize = 0;
break;
sigChldAction.sa_handler = SIG_IGN;
sigaction (SIGCHLD, &sigChldAction, NULL);
- if ((pidfile = cf_get_option ("PIDFile", PIDFILE)) == NULL)
+ if ((1 != have_pidfile)
+ && ((pidfile = cf_get_option ("PIDFile", PIDFILE)) == NULL))
{
fprintf (stderr, "Cannot obtain pidfile. This shoud not happen. Ever.");
return (1);
diff --git a/src/collectd.pod b/src/collectd.pod
index 26185eea444e63d6ab09f9ce6e74874a9534f50d..095463c139c99b5cf86bf9531439d27adf34a1cb 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.
+
=item B<-f>
Don't fork to the background. I<collectd> will also B<not> close standard file