Answer: To let running turns finish before a restart, set `--drain-wait-sec` and raise your stop timeout to at least that wait plus 80 seconds. For example, with `--drain-wait-sec 120`, replace the `90` in the Kubernetes or Docker Compose recipe with `200`. Status: Confirmed Entry: tool/claude-code/admin-and-enterprise/graceful-shutdown-running-turns Revision: 3 Digest: sha256:59bf02d750ff8c92 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:05:39Z Last changed: 2026-11-18T12:19:58Z (Docker Compose stop timeout: — → stop_grace_period) Last verified: 2026-11-20T12:24:56Z Next check: 2026-11-21T12:24:56Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Unit | Source | As of drain wait flag | --drain-wait-sec | | [1] | 2026-11-20 stop timeout margin | 80 seconds | seconds | [1] | 2026-11-20 default wait | 0 | seconds | [1] | 2026-11-20 example drain wait | 120 | seconds | [1] | 2026-11-20 example stop timeout replacement | 200 | seconds | [1] | 2026-11-20 Kubernetes stop timeout | terminationGracePeriodSeconds | | [1] | 2026-11-20 Docker Compose stop timeout | stop_grace_period | | [1] | 2026-11-20 Sources: [1] Anthropic. "Deploy self-hosted environments to production". https://code.claude.com/docs/en/self-hosted-environments-deploy.md Role: primary. Accessed: 2026-11-20T12:24:56Z Quote: "set `--drain-wait-sec`, and raise your stop timeout to at least that wait plus 80 seconds" (Supports: drain wait flag) Quote: "raise your stop timeout to at least that wait plus 80 seconds" (Supports: stop timeout margin) Quote: "With the default wait of `0`, a restart cuts off any turn that's still running" (Supports: default wait) Quote: "with `--drain-wait-sec 120`, replace the `90` in the" (Supports: example drain wait) Quote: "replace the `90` in the [Kubernetes](#kubernetes) or [Docker Compose](#docker-compose) recipe with `200`" (Supports: example stop timeout replacement) Quote: "`terminationGracePeriodSeconds` in Kubernetes" (Supports: Kubernetes stop timeout) Quote: "`stop_grace_period` in Docker Compose" (Supports: Docker Compose stop timeout) Published: 2026-11-20T03:48:50Z Snapshot SHA-256: e3fbe3f6840c260e4c0a51b93050a75e498c052fda2653b5a9ca7a45ebfa987c (captured 2026-11-20T12:24:53Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:24:56Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:24:56Z Last attempt: 2026-11-20T12:24:56Z Notes and limitations: Extracted automatically from a single official source (section "Let running turns finish before a restart"). Related: https://latestn.com/tool/claude-code/admin-and-enterprise/how-gateway-works How does a gateway work between Claude Code and the model provider? https://latestn.com/tool/claude-code/admin-and-enterprise/launcher-process-coverage Which processes does the Claude Code corporate launcher cover, and which start outside it? https://latestn.com/tool/claude-code/admin-and-enterprise/launcher-value-format-arguments What format should the Claude Code launcher value use and how are arguments passed to it? https://latestn.com/tool/claude-code/admin-and-enterprise/gcp-gateway-prerequisites What do I need to set up before deploying Claude apps gateway on Google Cloud? https://latestn.com/tool/claude-code/admin-and-enterprise/gcp-gateway-terraform-reference What Terraform configuration does the Claude apps gateway Google Cloud example use? https://latestn.com/tool/claude-code/admin-and-enterprise/ghes-admin-setup What GitHub App permissions and network requirements are needed to set up Claude Code with GitHub Enterprise Server? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-18T12:19:58Z | changed | Docker Compose stop timeout: — → stop_grace_period | [1] 2026-11-18T12:19:58Z | changed | Kubernetes stop timeout: — → terminationGracePeriodSeconds | [1] 2026-11-18T12:19:58Z | changed | example stop timeout replacement: — → 200 | [1] 2026-11-18T12:19:58Z | changed | Docker Compose stop timeout setting: stop_grace_period → — | [1] 2026-11-18T12:19:58Z | changed | Kubernetes stop timeout setting: terminationGracePeriodSeconds → — | [1] 2026-11-18T12:19:58Z | changed | example stop timeout: 200 → — | [1] 2026-11-15T12:25:10Z | changed | Docker Compose stop timeout setting: — → stop_grace_period | [1] 2026-11-15T12:25:10Z | changed | Kubernetes stop timeout setting: — → terminationGracePeriodSeconds | [1] 2026-11-15T12:25:10Z | changed | Docker Compose stop timeout: stop_grace_period → — | [1] 2026-11-15T12:25:10Z | changed | Kubernetes stop timeout: terminationGracePeriodSeconds → — | [1] 2026-11-13T03:05:39Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/admin-and-enterprise/graceful-shutdown-running-turns/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/admin-and-enterprise/graceful-shutdown-running-turns POST: https://latestn.com/dispute/tool/claude-code/admin-and-enterprise/graceful-shutdown-running-turns with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/admin-and-enterprise/graceful-shutdown-running-turns?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I let running turns finish before a restart on a Claude Code self-hosted runner? Revision 3, last verified 2026-11-20T12:24:56Z. https://latestn.com/tool/claude-code/admin-and-enterprise/graceful-shutdown-running-turns (accessed 2026-11-21T10:04:03Z). @misc{LatestN_tool_claude_code_admin_and_enterprise_graceful_shutdown_running_turns_r3, title = {How do I let running turns finish before a restart on a Claude Code self-hosted runner?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/admin-and-enterprise/graceful-shutdown-running-turns}}, note = {Revision 3; digest sha256:59bf02d750ff8c92; last verified 2026-11-20T12:24:56Z; accessed 2026-11-21T10:04:03Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/admin-and-enterprise/graceful-shutdown-running-turns