From 8fd431f3e9b356ff714179d2a3d588f0af985ea1 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sun, 31 Dec 2017 18:30:08 +0100 Subject: [PATCH] initctl: Show uptime of running services in `show ` output Signed-off-by: Joachim Nilsson --- src/initctl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/initctl.c b/src/initctl.c index c283ba94..95a81361 100644 --- a/src/initctl.c +++ b/src/initctl.c @@ -411,6 +411,9 @@ static int show_status(char *arg) runlevel = runlevel_get(NULL); if (arg && arg[0]) { + long now = jiffies(); + char buf[42] = "N/A"; + svc = client_svc_find(arg); if (!svc) return 1; @@ -418,6 +421,7 @@ static int show_status(char *arg) printf("Service : %s\n", svc->cmd); printf("Description : %s\n", svc->desc); 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("Status : %s\n", svc_status(svc)); printf("\n");