From 09115f9a97b820c69eb29d3621a4e65dac3dbfc5 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 25 Mar 2018 22:07:33 +0200 Subject: Print status when starting a service marked as respawn Signed-off-by: David Oberhollenzer --- initd/init.h | 5 +++-- initd/main.c | 3 +++ initd/status.c | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'initd') diff --git a/initd/init.h b/initd/init.h index 826af0f..cbe22aa 100644 --- a/initd/init.h +++ b/initd/init.h @@ -29,6 +29,7 @@ enum { STATUS_OK = 0, STATUS_FAIL, STATUS_WAIT, + STATUS_STARTED, }; /********** runlst.c **********/ @@ -76,8 +77,8 @@ int setup_tty(void); /********** status.c **********/ /* - Print a status message. Type is either STATUS_OK, STATUS_FAIL or - STATUS_WAIT. + Print a status message. Type is either STATUS_OK, STATUS_FAIL, + STATUS_WAIT or STATUS_STARTED. A new-line is appended to the mssage, UNLESS type is STATUS_WAIT. diff --git a/initd/main.c b/initd/main.c index c4b796c..efd3a30 100644 --- a/initd/main.c +++ b/initd/main.c @@ -123,6 +123,9 @@ static void start_runlevel(int level) true); delsvc(svc); } else { + if (svc->type == SVC_RESPAWN) + print_status(svc->desc, STATUS_STARTED, false); + svc->pid = runlst(svc->exec, svc->num_exec, svc->ctty); if (svc->pid == -1) { print_status(svc->desc, STATUS_FAIL, false); diff --git a/initd/status.c b/initd/status.c index 67b049b..2151fc3 100644 --- a/initd/status.c +++ b/initd/status.c @@ -30,6 +30,9 @@ void print_status(const char *msg, int type, bool update) case STATUS_WAIT: str = "\033[22;33m .. \033[0m"; break; + case STATUS_STARTED: + str = "\033[22;32m UP \033[0m"; + break; default: str = "\033[22;32m OK \033[0m"; break; -- cgit v1.2.3