aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2017-10-26 13:11:12 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2017-10-26 13:11:12 -0500
commit82da844b42ff83b2ebf944198e56ac2d81851897 (patch)
tree90349e1c12f471c340be913681f3992daf33b10c /sh
parent667a09983ca5311824aa88c42d39a495c540fc4c (diff)
implement "unsupervised" status
The unsupervised status is to be used when a supervisor of a supervised service dies but leaves the service daemon itself running.
Diffstat (limited to 'sh')
-rw-r--r--sh/supervise-daemon.sh21
1 files changed, 5 insertions, 16 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
}