projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
email plugin: Change owner and mode of the UNIX socket if possible.
[collectd.git]
/
src
/
collectd.c
diff --git
a/src/collectd.c
b/src/collectd.c
index
2720590
..
64da576
100644
(file)
--- a/
src/collectd.c
+++ b/
src/collectd.c
@@
-123,6
+123,8
@@
static void exit_usage (char *name)
" General:\n"
" -C <file> Configuration file.\n"
" Default: "CONFIGFILE"\n"
" 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
#if COLLECT_DAEMON
" -f Don't fork to the background.\n"
#endif
@@
-191,7
+193,7
@@
static int start_client (void)
curtime = time (NULL);
/* Issue all plugins */
curtime = time (NULL);
/* Issue all plugins */
- plugin_read_all ();
+ plugin_read_all (
&loop
);
if (gettimeofday (&tv_now, NULL) < 0)
{
if (gettimeofday (&tv_now, NULL) < 0)
{
@@
-205,7
+207,7
@@
static int start_client (void)
continue;
}
continue;
}
- while (
nanosleep (&ts_wait, &ts_wait) == -1
)
+ while (
(loop == 0) && (nanosleep (&ts_wait, &ts_wait) == -1)
)
{
if (errno != EINTR)
{
{
if (errno != EINTR)
{
@@
-281,7
+283,7
@@
int main (int argc, char **argv)
char *configfile = CONFIGFILE;
#if COLLECT_DAEMON
struct sigaction sigChldAction;
char *configfile = CONFIGFILE;
#if COLLECT_DAEMON
struct sigaction sigChldAction;
- char *pidfile =
PIDFILE
;
+ char *pidfile =
NULL
;
pid_t pid;
int daemonize = 1;
#endif
pid_t pid;
int daemonize = 1;
#endif
@@
-291,6
+293,8
@@
int main (int argc, char **argv)
#if HAVE_LIBRRD
operating_mode = MODE_LOCAL;
#if HAVE_LIBRRD
operating_mode = MODE_LOCAL;
+#else
+ operating_mode = MODE_CLIENT;
#endif
/* open syslog */
#endif
/* open syslog */
@@
-303,7
+307,7
@@
int main (int argc, char **argv)
c = getopt (argc, argv, "hC:"
#if COLLECT_DAEMON
c = getopt (argc, argv, "hC:"
#if COLLECT_DAEMON
- "f"
+ "f
P:
"
#endif
);
#endif
);
@@
-316,6
+320,9
@@
int main (int argc, char **argv)
configfile = optarg;
break;
#if COLLECT_DAEMON
configfile = optarg;
break;
#if COLLECT_DAEMON
+ case 'P':
+ pidfile = optarg;
+ break;
case 'f':
daemonize = 0;
break;
case 'f':
daemonize = 0;
break;
@@
-366,7
+373,8
@@
int main (int argc, char **argv)
sigChldAction.sa_handler = SIG_IGN;
sigaction (SIGCHLD, &sigChldAction, NULL);
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);
{
fprintf (stderr, "Cannot obtain pidfile. This shoud not happen. Ever.");
return (1);