mirror of
https://github.com/pygos/init.git
synced 2024-12-22 07:10:49 +01:00
initd: don't start runsvc for services without exec block
First in rdsvc, tag the services that *do* have exec lines, even if we don't read them. Second, if a service does not have that flag set, don't try to execute it. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
parent
390175c406
commit
e21840cfce
3 changed files with 13 additions and 1 deletions
|
@ -156,6 +156,14 @@ bool supervisor_process_queues(void)
|
|||
svc = queue;
|
||||
queue = queue->next;
|
||||
|
||||
if (!(svc->flags & SVC_FLAG_HAS_EXEC)) {
|
||||
print_status(svc->desc, STATUS_OK, false);
|
||||
svc->status = EXIT_SUCCESS;
|
||||
svc->next = completed;
|
||||
completed = svc;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (start_service(svc) != 0)
|
||||
return true;
|
||||
|
||||
|
@ -171,7 +179,7 @@ bool supervisor_process_queues(void)
|
|||
singleshot += 1;
|
||||
break;
|
||||
}
|
||||
|
||||
out:
|
||||
if (singleshot == 0 && queue == NULL && !waiting)
|
||||
target_completed(target);
|
||||
return true;
|
||||
|
|
|
@ -41,6 +41,8 @@ enum {
|
|||
enum {
|
||||
/* truncate stdout */
|
||||
SVC_FLAG_TRUNCATE_OUT = 0x01,
|
||||
|
||||
SVC_FLAG_HAS_EXEC = 0x10,
|
||||
};
|
||||
|
||||
typedef struct service_t {
|
||||
|
|
|
@ -81,6 +81,8 @@ static int svc_exec(void *user, char *arg, rdline_t *rd, int flags)
|
|||
service_t *svc = user;
|
||||
exec_t *e, *end;
|
||||
|
||||
svc->flags |= SVC_FLAG_HAS_EXEC;
|
||||
|
||||
if (flags & RDSVC_NO_EXEC)
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue