Line 0
Link Here
|
|
|
1 |
--- src/rtgpoll.c.orig 2010-04-21 21:24:13.686718318 +0100 |
2 |
+++ src/rtgpoll.c 2010-04-21 21:33:53.755065067 +0100 |
3 |
@@ -13,6 +13,7 @@ |
4 |
stats_t stats = |
5 |
{PTHREAD_MUTEX_INITIALIZER, 0, 0, 0, 0, 0, 0, 0, 0, 0.0}; |
6 |
char *target_file = NULL; |
7 |
+char *pidfile = NULL; |
8 |
target_t *current = NULL; |
9 |
MYSQL mysql; |
10 |
int entries = 0; |
11 |
@@ -41,7 +42,7 @@ |
12 |
config_defaults(&set); |
13 |
|
14 |
/* Parse the command-line. */ |
15 |
- while ((ch = getopt(argc, argv, "c:dhmt:vz")) != EOF) |
16 |
+ while ((ch = getopt(argc, argv, "c:dhmp:t:vz")) != EOF) |
17 |
switch ((char) ch) { |
18 |
case 'c': |
19 |
conf_file = optarg; |
20 |
@@ -55,6 +56,9 @@ |
21 |
case 'm': |
22 |
set.multiple++; |
23 |
break; |
24 |
+ case 'p': |
25 |
+ pidfile = optarg; |
26 |
+ break; |
27 |
case 't': |
28 |
target_file = optarg; |
29 |
break; |
30 |
@@ -66,6 +70,9 @@ |
31 |
break; |
32 |
} |
33 |
|
34 |
+ if (!pidfile) |
35 |
+ pidfile = DEFAULT_PIDFILE; |
36 |
+ |
37 |
if (set.verbose >= LOW) |
38 |
printf("RTG version %s starting.\n", VERSION); |
39 |
|
40 |
@@ -78,7 +85,7 @@ |
41 |
sigaddset(&signal_set, SIGINT); |
42 |
sigaddset(&signal_set, SIGQUIT); |
43 |
if (!set.multiple) |
44 |
- checkPID(PIDFILE); |
45 |
+ checkPID(pidfile); |
46 |
|
47 |
if (pthread_sigmask(SIG_BLOCK, &signal_set, NULL) != 0) |
48 |
printf("pthread_sigmask error\n"); |
49 |
@@ -244,7 +251,7 @@ |
50 |
if (set.verbose >= LOW) |
51 |
printf("Quiting: received signal %d.\n", sig_number); |
52 |
rtg_dbdisconnect(&mysql); |
53 |
- unlink(PIDFILE); |
54 |
+ unlink(pidfile); |
55 |
exit(1); |
56 |
break; |
57 |
} |
58 |
@@ -259,6 +266,7 @@ |
59 |
printf("\nOptions:\n"); |
60 |
printf(" -c <file> Specify configuration file\n"); |
61 |
printf(" -d Disable database inserts\n"); |
62 |
+ printf(" -p <file> Specify pid file (defaults to /tmp/rtgpoll.pid)\n"); |
63 |
printf(" -t <file> Specify target file\n"); |
64 |
printf(" -v Increase verbosity\n"); |
65 |
printf(" -m Allow multiple instances\n"); |