SIGTERM
The signal that politely asks a process to finish its work and exit.
In more detail
It is what kill sends by default and what service managers send first when stopping a program. A well-behaved program finishes or abandons its current work cleanly and exits; one simply ended by the signal reports exit code 143 (128 + 15).
Examples
The course lab shows it: with no handler the bad variant exits with -15, killed by the signal; with a handler the good variant logs its shutdown and exits 0.signal.signal(signal.SIGTERM, shutdown)signal.Notify(stop, syscall.SIGTERM)It is what kill sends by default and what systemctl stop sends first. A well-behaved program closes files, finishes current work and exits; a program simply ended by it reports exit status 143 in the shell. Always try it before SIGKILL.target=42 signal=TERM action=graceful records a polite stop request.Related terms
- signal — A short notification the kernel delivers to a process, such as please stop or stop now.
- SIGKILL — The signal that ends a process immediately; it cannot be caught or ignored.
- kill — The command that sends a signal to a process or job, SIGTERM by default, despite its name.
- trap builtin — The builtin that runs a command or function when the shell receives a signal or exits, used for cleanup.
- graceful shutdown — Stopping a service in an orderly way: finish current work, close connections, then exit.
- docker stop — Asks a running container to shut down cleanly, then forces it if it does not.
- disposability — The property of a process that can be started or stopped at a moment’s notice without harm.
- terminationGracePeriodSeconds — The pod setting for how long Kubernetes waits after sending SIGTERM before killing the container with SIGKILL, 30 seconds by default.
Taught in
- trap, Cleanup And Temporary Files — Bash Scripting & Command Line Automation
- Processes, Jobs And Signals — Bash Scripting & Command Line Automation
- Container Images The Exam Way — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Disposability, Dev Prod Parity And Logs — DevOps & Site Reliability Engineering
- Run, Stop, Restart And Remove A Container — Docker Architecture & Production Containers
- CMD, ENTRYPOINT, USER And Process Signals — Docker Architecture & Production Containers
- Diagnose Crashes, Resource Limits And Unhealthy Containers — Docker Architecture & Production Containers
- Harden And Deliver The Complete Service Stack — Docker Architecture & Production Containers
- Health Probes & Graceful Shutdown: Kubernetes Lifecycles — Production Full-Stack Engineering
- Graceful Shutdown on SIGTERM — Concurrent Systems Programming with Go
- Signals, And What kill Really Sends — Linux Fundamentals & Systems Administration
- Close Phase & Signal Dispatch: Sockets & Teardown — Node.js Internals & Backend Services
- Production Hardening: Graceful Shutdown & Docker — Node.js Internals & Backend Services
- The Reindex That Died With The VPN: Jobs, cron, at And Timers — CompTIA Linux+ (XK0-006) Exam Prep
- Performance Triage: Processor, Memory Or Disk? — Linux Foundation Certified System Administrator (LFCS) Exam Prep
- Environment Profiles: Which File Does This Shell Read? — Linux Foundation Certified System Administrator (LFCS) Exam Prep
- Runlevels, Targets And A Polite Shutdown — LPIC-1 Linux Administrator (101-500 and 102-500) Exam Prep
References
- signal(7) manual page
- docker container stop reference
- Kubernetes: Termination of pods
- Node.js: Signal events
- man7: kill(1)