aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sh/supervise-daemon.sh21
-rw-r--r--src/rc/rc-status.c11
2 files changed, 15 insertions, 17 deletions
diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh
index d2cfe932..e5d8d461 100644
--- a/sh/supervise-daemon.sh
+++ b/sh/supervise-daemon.sh
@@ -58,22 +58,11 @@ supervise_stop()
_check_supervised()
{
- [ "$RC_UNAME" != Linux ] && return 0
- local child_pid="$(service_get_value "child_pid")"
- local pid="$(cat ${pidfile})"
- if [ -n "${child_pid}" ]; then
- if ! [ -e "/proc/${pid}" ] && [ -e "/proc/${child_pid}" ]; then
- if [ -e "/proc/self/ns/pid" ] && [ -e "/proc/${child_pid}/ns/pid" ]; then
- local n1 n2
- n1=$(readlink "/proc/self/ns/pid")
- n2=$(readlink "/proc/${child_pid}/ns/pid")
- if [ "${n1}" = "${n2}" ]; then
- return 1
- fi
- else
- return 1
- fi
- fi
+ local child_pid start_time
+ child_pid="$(service_get_value "child_pid")"
+ start_time="$(service_get_value "start_time")"
+ if [ -n "${child_pid}" ] && [ -n "${start_time}" ]; then
+ return 1
fi
return 0
}
diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c
index 9a094d47..d29f876a 100644
--- a/src/rc/rc-status.c
+++ b/src/rc/rc-status.c
@@ -128,6 +128,8 @@ print_service(const char *service)
{
char status[60];
char uptime [40];
+ char *child_pid = NULL;
+ char *start_time = NULL;
int cols = printf(" %s", service);
const char *c = ecolor(ECOLOR_GOOD);
RC_SERVICE state = rc_service_state(service);
@@ -147,7 +149,14 @@ print_service(const char *service)
rc_service_daemons_crashed(service) &&
errno != EACCES)
{
- snprintf(status, sizeof(status), " crashed ");
+ child_pid = rc_service_value_get(service, "child_pid");
+ start_time = rc_service_value_get(service, "start_time");
+ if (start_time && child_pid)
+ snprintf(status, sizeof(status), " unsupervised ");
+ else
+ snprintf(status, sizeof(status), " crashed ");
+ free(child_pid);
+ free(start_time);
} else {
get_uptime(service, uptime, 40);
snprintf(status, sizeof(status), " started %s", uptime);