mirror of
https://github.com/troglobit/finit.git
synced 2026-11-14 19:03:16 +00:00
Improve output from 'finit status'
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
6d3972cca8
commit
6a27ad8997
1 file changed
+12
-2
@@ -104,6 +104,17 @@ int show_version(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *svc_status(svc_t *svc)
|
||||||
|
{
|
||||||
|
if (svc->pid)
|
||||||
|
return "running";
|
||||||
|
|
||||||
|
if (svc_is_inetd(svc))
|
||||||
|
return "inetd";
|
||||||
|
|
||||||
|
return "waiting";
|
||||||
|
}
|
||||||
|
|
||||||
static int show_status(void)
|
static int show_status(void)
|
||||||
{
|
{
|
||||||
svc_t *svc;
|
svc_t *svc;
|
||||||
@@ -111,8 +122,7 @@ static int show_status(void)
|
|||||||
printf("Status PID Runlevels Service Description\n");
|
printf("Status PID Runlevels Service Description\n");
|
||||||
printf("==============================================================================\n");
|
printf("==============================================================================\n");
|
||||||
for (svc = svc_iterator(1); svc; svc = svc_iterator(0)) {
|
for (svc = svc_iterator(1); svc; svc = svc_iterator(0)) {
|
||||||
printf("%7s %-6d %-9s %-20s %s\n",
|
printf("%7s %-6d %-9s %-20s %s\n", svc_status(svc), svc->pid,
|
||||||
svc->pid ? "running" : "waiting", svc->pid,
|
|
||||||
runlevel_string(svc->runlevels), svc->cmd, svc->desc);
|
runlevel_string(svc->runlevels), svc->cmd, svc->desc);
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
int i;
|
int i;
|
||||||
|
|||||||
Reference in new issue
Block a user