mirror of
https://github.com/troglobit/finit.git
synced 2026-11-02 13:20:32 +00:00
initctl: Show uptime of running services in show <NAME> output
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
50f128cd1d
commit
8fd431f3e9
1 file changed
+4
@@ -411,6 +411,9 @@ static int show_status(char *arg)
|
|||||||
runlevel = runlevel_get(NULL);
|
runlevel = runlevel_get(NULL);
|
||||||
|
|
||||||
if (arg && arg[0]) {
|
if (arg && arg[0]) {
|
||||||
|
long now = jiffies();
|
||||||
|
char buf[42] = "N/A";
|
||||||
|
|
||||||
svc = client_svc_find(arg);
|
svc = client_svc_find(arg);
|
||||||
if (!svc)
|
if (!svc)
|
||||||
return 1;
|
return 1;
|
||||||
@@ -418,6 +421,7 @@ static int show_status(char *arg)
|
|||||||
printf("Service : %s\n", svc->cmd);
|
printf("Service : %s\n", svc->cmd);
|
||||||
printf("Description : %s\n", svc->desc);
|
printf("Description : %s\n", svc->desc);
|
||||||
printf("PID : %d\n", svc->pid);
|
printf("PID : %d\n", svc->pid);
|
||||||
|
printf("Uptime : %s\n", svc->pid ? uptime(now - svc->start_time, buf, sizeof(buf)) : buf);
|
||||||
printf("Runlevels : %s\n", runlevel_string(runlevel, svc->runlevels));
|
printf("Runlevels : %s\n", runlevel_string(runlevel, svc->runlevels));
|
||||||
printf("Status : %s\n", svc_status(svc));
|
printf("Status : %s\n", svc_status(svc));
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|||||||
Reference in new issue
Block a user