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

Taught in

References

Certification courses