aboutsummaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2018-12-02 10:13:10 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2018-12-02 18:33:25 -0600
commitfa6611b5af94548e901e587fcd36f4fb59124975 (patch)
tree0a26cd8e78e53dcc63472483c401d136cc0c784f /src/rc
parentdb01442580847d36f232527200e50091431c32b5 (diff)
rc-status: add --supervised option to show supervised services
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/rc-status.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c
index 56395873..9dbf7c6b 100644
--- a/src/rc/rc-status.c
+++ b/src/rc/rc-status.c
@@ -29,7 +29,7 @@
const char *applet = NULL;
const char *extraopts = NULL;
-const char *getoptstring = "aclmrsu" getoptstring_COMMON;
+const char *getoptstring = "aclmrsSu" getoptstring_COMMON;
const struct option longopts[] = {
{"all", 0, NULL, 'a'},
{"crashed", 0, NULL, 'c'},
@@ -37,6 +37,7 @@ const struct option longopts[] = {
{"manual", 0, NULL, 'm'},
{"runlevel", 0, NULL, 'r'},
{"servicelist", 0, NULL, 's'},
+ {"supervised", 0, NULL, 'S'},
{"unused", 0, NULL, 'u'},
longopts_COMMON
};
@@ -47,6 +48,7 @@ const char * const longopts_help[] = {
"Show manually started services",
"Show the name of the current runlevel",
"Show service list",
+ "show supervised services",
"Show services not assigned to any runlevel",
longopts_help_COMMON
};
@@ -296,6 +298,14 @@ int main(int argc, char **argv)
printf("%s\n", runlevel);
goto exit;
/* NOTREACHED */
+ case 'S':
+ services = rc_services_in_state(RC_SERVICE_STARTED);
+ TAILQ_FOREACH(s, services, entries)
+ if (rc_service_value_get(s->value, "child_pid")) {
+ printf("%s\n", s->value);
+ }
+ goto exit;
+ /* NOTREACHED */
case 's':
services = rc_services_in_runlevel(NULL);
print_services(NULL, services);