diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-07-12 02:25:42 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-07-12 03:07:01 +0200 |
commit | b708e7cea941538bfd5e20ce0a723c19b7da7d1d (patch) | |
tree | 8d98112fa0c7c4432bd2058eb1e087abad0e0dc5 /src/service.c | |
parent | f1dfb62962fd25c1fba9d9479cb5df2d23e6712d (diff) |
execute: optionally ignore return status of invoked commands
Diffstat (limited to 'src/service.c')
-rw-r--r-- | src/service.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/service.c b/src/service.c index 481c044b63..f8b4ff6a24 100644 --- a/src/service.c +++ b/src/service.c @@ -2171,7 +2171,6 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { assert(pid >= 0); success = is_clean_exit(code, status); - s->failure = s->failure || !success; if (s->main_pid == pid) { @@ -2181,9 +2180,13 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { if (s->type != SERVICE_FORKING) { assert(s->exec_command[SERVICE_EXEC_START]); s->exec_command[SERVICE_EXEC_START]->exec_status = s->main_exec_status; + + if (s->exec_command[SERVICE_EXEC_START]->ignore) + success = true; } log_debug("%s: main process exited, code=%s, status=%i", u->meta.id, sigchld_code_to_string(code), status); + s->failure = s->failure || !success; /* The service exited, so the service is officially * gone. */ @@ -2230,12 +2233,17 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { } else if (s->control_pid == pid) { - if (s->control_command) + if (s->control_command) { exec_status_exit(&s->control_command->exec_status, pid, code, status); + if (s->control_command->ignore) + success = true; + } + s->control_pid = 0; log_debug("%s: control process exited, code=%s status=%i", u->meta.id, sigchld_code_to_string(code), status); + s->failure = s->failure || !success; /* If we are shutting things down anyway we * don't care about failing commands. */ |