in response to nathan's comment..
--- a/mgmt/pcp/src/pmcd/src/pmcd.c 2007-07-24 14:41:58.000000000 +1000
+++ b/mgmt/pcp/src/pmcd/src/pmcd.c 2007-07-24 14:28:57.140447430 +1000
@@ -1206,22 +1206,23 @@
/*NOTREACHED*/
}
- run_dir = pmGetConfig("PCP_RUN_DIR");
- i = strlen(run_dir);
- pidpath = malloc(i + strlen(PIDFILE) + 1);
- memcpy(pidpath, run_dir, i);
- strcpy(pidpath + i, PIDFILE);
- pidfile = fopen(pidpath, "w");
- if (pidfile == NULL) {
- fprintf(stderr, "Error: Cant open pidfile %s\n", pidpath);
- DontStart();
- /*NOTREACHED*/
- }
- fprintf(pidfile, "%d", getpid());
- fflush(pidfile);
- fclose(pidfile);
- free(pidpath);
-
+ if (run_daemon) {
+ run_dir = pmGetConfig("PCP_RUN_DIR");
+ i = strlen(run_dir);
+ pidpath = malloc(i + strlen(PIDFILE) + 1);
+ memcpy(pidpath, run_dir, i);
+ strcpy(pidpath + i, PIDFILE);
+ pidfile = fopen(pidpath, "w");
+ if (pidfile == NULL) {
+ fprintf(stderr, "Error: Cant open pidfile %s\n", pidpath);
+ DontStart();
+ /*NOTREACHED*/
+ }
+ fprintf(pidfile, "%d", getpid());
+ fflush(pidfile);
+ fclose(pidfile);
+ free(pidpath);
+ }
PrintAgentInfo(stderr);
__pmAccDumpHosts(stderr);
fprintf(stderr, "\npmcd: PID = %u", (int)getpid());
Dr.Michael("Kimba")Newton kimbrr@xxxxxxx
|