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>
#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);
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