aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
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 'src')
-rw-r--r--src/rc/rc-status.c11
1 files changed, 10 insertions, 1 deletions
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);