supervise-daemon: use RC_SVCNAME as the first argument to the daemon
This makes ps show which service the supervisor is monitoring.
This commit is contained in:
parent
3fe99c8b82
commit
913b2ca537
@ -22,7 +22,7 @@ supervise_start()
|
||||
# The eval call is necessary for cases like:
|
||||
# command_args="this \"is a\" test"
|
||||
# to work properly.
|
||||
eval supervise-daemon --start \
|
||||
eval supervise-daemon "${RC_SVCNAME}" --start \
|
||||
${retry:+--retry} $retry \
|
||||
${chroot:+--chroot} $chroot \
|
||||
${pidfile:+--pidfile} $pidfile \
|
||||
@ -49,7 +49,7 @@ supervise_stop()
|
||||
pidfile="${startpidfile:-$pidfile}"
|
||||
[ -n "$pidfile" ] || return 0
|
||||
ebegin "Stopping ${name:-$RC_SVCNAME}"
|
||||
supervise-daemon --stop \
|
||||
supervise-daemon "${RC_SVCNAME}" --stop \
|
||||
${pidfile:+--pidfile} $chroot$pidfile \
|
||||
${stopsig:+--signal} $stopsig
|
||||
|
||||
|
@ -561,8 +561,13 @@ int main(int argc, char **argv)
|
||||
applet = basename_c(argv[0]);
|
||||
atexit(cleanup);
|
||||
svcname = getenv("RC_SVCNAME");
|
||||
if (!svcname)
|
||||
eerrorx("%s: The RC_SVCNAME environment variable is not set", applet);
|
||||
openlog(applet, LOG_PID, LOG_DAEMON);
|
||||
|
||||
if (argc >= 1 && svcname && strcmp(argv[1], svcname))
|
||||
eerrorx("%s: the first argument must be %s", applet, svcname);
|
||||
|
||||
if ((tmp = getenv("SSD_NICELEVEL")))
|
||||
if (sscanf(tmp, "%d", &nicelevel) != 1)
|
||||
eerror("%s: invalid nice level `%s' (SSD_NICELEVEL)",
|
||||
@ -583,6 +588,17 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
*cmdline = '\0';
|
||||
c = argv;
|
||||
while (c && *c) {
|
||||
strcat(cmdline, *c);
|
||||
strcat(cmdline, " ");
|
||||
c++;
|
||||
}
|
||||
if (svcname) {
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
while ((opt = getopt_long(argc, argv, getoptstring, longopts,
|
||||
(int *) 0)) != -1)
|
||||
switch (opt) {
|
||||
@ -721,14 +737,6 @@ int main(int argc, char **argv)
|
||||
|
||||
if (!pidfile && !reexec)
|
||||
eerrorx("%s: --pidfile must be specified", applet);
|
||||
|
||||
*cmdline = '\0';
|
||||
c = argv;
|
||||
while (c && *c) {
|
||||
strcat(cmdline, *c);
|
||||
strcat(cmdline, " ");
|
||||
c++;
|
||||
}
|
||||
endpwent();
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
Loading…
Reference in New Issue
Block a user