diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-02-03 23:38:50 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-02-03 23:58:47 +0100 |
commit | ce359e98f87c7fbe5aa1d275e43cf088ce46c2b0 (patch) | |
tree | 2b7dad70669fd5af09316c8bfcf9a783a3f199d2 /src/core/service.c | |
parent | 2d60169dd60d503712d5c2e81a01158e82e636e6 (diff) |
core: when a service's ExecStartPre= times out, skip ExecStop=
This makes sure we never run two control processes at the same time, we cannot keep track off.
This introduces a slight change of behaviour but cleans up the definition of ExecStop= and ExecStopPost=. The former is
now invoked only if the service managed to start-up correctly. The latter is called even if start-up failed half-way.
Thus, ExecStopPost= may be used as clean-up step for both successful and failed start-up attempts, but ExecStop='s
purpose is clearly defined as being responsible for shutting down the service and nothing else.
The precise behaviour of this was not documented yet. This commit adds the necessary docs.
Fixes: #1254
Diffstat (limited to 'src/core/service.c')
-rw-r--r-- | src/core/service.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/service.c b/src/core/service.c index a9345e38b9..4942fc425d 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -2788,7 +2788,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { case SERVICE_START_POST: if (f != SERVICE_SUCCESS) { - service_enter_stop(s, f); + service_enter_signal(s, SERVICE_STOP_SIGTERM, f); break; } @@ -2878,7 +2878,7 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us case SERVICE_START_POST: log_unit_warning(UNIT(s), "Start-post operation timed out. Stopping."); - service_enter_stop(s, SERVICE_FAILURE_TIMEOUT); + service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_TIMEOUT); break; case SERVICE_RUNNING: |