Lines 56-68
Link Here
|
56 |
struct pidfh *ppfh, *pfh; |
56 |
struct pidfh *ppfh, *pfh; |
57 |
sigset_t mask, oldmask; |
57 |
sigset_t mask, oldmask; |
58 |
int ch, nochdir, noclose, restart, serrno; |
58 |
int ch, nochdir, noclose, restart, serrno; |
59 |
const char *pidfile, *ppidfile, *user; |
59 |
const char *pidfile, *ppidfile, *ptitle, *user; |
60 |
pid_t otherpid, pid; |
60 |
pid_t otherpid, pid; |
61 |
|
61 |
|
62 |
nochdir = noclose = 1; |
62 |
nochdir = noclose = 1; |
63 |
restart = 0; |
63 |
restart = 0; |
64 |
ppidfile = pidfile = user = NULL; |
64 |
ppidfile = pidfile = ptitle = user = NULL; |
65 |
while ((ch = getopt(argc, argv, "cfp:P:ru:")) != -1) { |
65 |
while ((ch = getopt(argc, argv, "cfp:P:rt:u:")) != -1) { |
66 |
switch (ch) { |
66 |
switch (ch) { |
67 |
case 'c': |
67 |
case 'c': |
68 |
nochdir = 0; |
68 |
nochdir = 0; |
Lines 79-84
Link Here
|
79 |
case 'r': |
79 |
case 'r': |
80 |
restart = 1; |
80 |
restart = 1; |
81 |
break; |
81 |
break; |
|
|
82 |
case 't': |
83 |
ptitle = optarg; |
84 |
break; |
82 |
case 'u': |
85 |
case 'u': |
83 |
user = optarg; |
86 |
user = optarg; |
84 |
break; |
87 |
break; |
Lines 204-210
Link Here
|
204 |
err(1, "%s", argv[0]); |
207 |
err(1, "%s", argv[0]); |
205 |
} |
208 |
} |
206 |
|
209 |
|
207 |
setproctitle("%s[%d]", argv[0], pid); |
210 |
if (ptitle) { |
|
|
211 |
setproctitle("%s", ptitle); |
212 |
} else { |
213 |
setproctitle("%s[%d]", argv[0], pid); |
214 |
} |
208 |
if (wait_child(pid, &mask) == 0 && restart) { |
215 |
if (wait_child(pid, &mask) == 0 && restart) { |
209 |
sleep(1); |
216 |
sleep(1); |
210 |
goto restart; |
217 |
goto restart; |