mirror of
https://github.com/pygos/init.git
synced 2024-11-22 19:19:47 +01:00
Print status when starting a service marked as respawn
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
parent
8fc5b24bdd
commit
09115f9a97
3 changed files with 9 additions and 2 deletions
|
@ -29,6 +29,7 @@ enum {
|
||||||
STATUS_OK = 0,
|
STATUS_OK = 0,
|
||||||
STATUS_FAIL,
|
STATUS_FAIL,
|
||||||
STATUS_WAIT,
|
STATUS_WAIT,
|
||||||
|
STATUS_STARTED,
|
||||||
};
|
};
|
||||||
|
|
||||||
/********** runlst.c **********/
|
/********** runlst.c **********/
|
||||||
|
@ -76,8 +77,8 @@ int setup_tty(void);
|
||||||
/********** status.c **********/
|
/********** status.c **********/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Print a status message. Type is either STATUS_OK, STATUS_FAIL or
|
Print a status message. Type is either STATUS_OK, STATUS_FAIL,
|
||||||
STATUS_WAIT.
|
STATUS_WAIT or STATUS_STARTED.
|
||||||
|
|
||||||
A new-line is appended to the mssage, UNLESS type is STATUS_WAIT.
|
A new-line is appended to the mssage, UNLESS type is STATUS_WAIT.
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,9 @@ static void start_runlevel(int level)
|
||||||
true);
|
true);
|
||||||
delsvc(svc);
|
delsvc(svc);
|
||||||
} else {
|
} else {
|
||||||
|
if (svc->type == SVC_RESPAWN)
|
||||||
|
print_status(svc->desc, STATUS_STARTED, false);
|
||||||
|
|
||||||
svc->pid = runlst(svc->exec, svc->num_exec, svc->ctty);
|
svc->pid = runlst(svc->exec, svc->num_exec, svc->ctty);
|
||||||
if (svc->pid == -1) {
|
if (svc->pid == -1) {
|
||||||
print_status(svc->desc, STATUS_FAIL, false);
|
print_status(svc->desc, STATUS_FAIL, false);
|
||||||
|
|
|
@ -30,6 +30,9 @@ void print_status(const char *msg, int type, bool update)
|
||||||
case STATUS_WAIT:
|
case STATUS_WAIT:
|
||||||
str = "\033[22;33m .. \033[0m";
|
str = "\033[22;33m .. \033[0m";
|
||||||
break;
|
break;
|
||||||
|
case STATUS_STARTED:
|
||||||
|
str = "\033[22;32m UP \033[0m";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
str = "\033[22;32m OK \033[0m";
|
str = "\033[22;32m OK \033[0m";
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue