From bf760801804e55b045aed54bf9b1d0b0131be3f2 Mon Sep 17 00:00:00 2001 From: Jan Klötzke Date: Tue, 16 Apr 2019 16:45:20 +0200 Subject: core: let user define start-/stop-timeout behaviour The usual behaviour when a timeout expires is to terminate/kill the service. This is what user usually want in production systems. To debug services that fail to start/stop (especially sporadic failures) it might be necessary to trigger the watchdog machinery and write core dumps, though. Likewise, it is usually just a waste of time to gracefully stop a stuck service. Instead it might save time to go directly into kill mode. This commit adds two new options to services: TimeoutStartFailureMode= and TimeoutStopFailureMode=. Both take the same values and tweak the behavior of systemd when a start/stop timeout expires: * 'terminate': is the default behaviour as it has always been, * 'abort': triggers the watchdog machinery and will send SIGABRT (unless WatchdogSignal was changed) and * 'kill' will directly send SIGKILL. To handle the stop failure mode in stop-post state too a new final-watchdog state needs to be introduced. --- src/basic/unit-def.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/basic/unit-def.c') diff --git a/src/basic/unit-def.c b/src/basic/unit-def.c index 64b2b2dd7e..94ec1f3d19 100644 --- a/src/basic/unit-def.c +++ b/src/basic/unit-def.c @@ -185,6 +185,7 @@ static const char* const service_state_table[_SERVICE_STATE_MAX] = { [SERVICE_STOP_SIGTERM] = "stop-sigterm", [SERVICE_STOP_SIGKILL] = "stop-sigkill", [SERVICE_STOP_POST] = "stop-post", + [SERVICE_FINAL_WATCHDOG] = "final-watchdog", [SERVICE_FINAL_SIGTERM] = "final-sigterm", [SERVICE_FINAL_SIGKILL] = "final-sigkill", [SERVICE_FAILED] = "failed", -- cgit v1.2.3