Glossary

SIGTERM

Also known as: signal 15

SIGTERM (signal 15) is the default signal sent by kill and the polite way to ask a process to terminate. Unlike SIGKILL, it can be caught or ignored by the process, giving the program a chance to flush buffers, close connections, release locks, and generally shut down cleanly. Most daemons install a SIGTERM handler specifically to handle graceful shutdown.

kill <PID>               # sends SIGTERM
kill -TERM <PID>         # explicit
kill -15 <PID>           # by number
pkill nginx              # by name
systemctl stop nginx     # sends SIGTERM to all service processes

Systemd sends SIGTERM when stopping a service and waits TimeoutStopSec (default 90 seconds) before escalating to SIGKILL. This gives services time for cleanup but sets an upper bound on how long a stop command can hang. Services that ignore SIGTERM and then get killed often leave stale lock files or half-written data—a common sign of a buggy daemon.

In scripts, trapping SIGTERM lets a shell script clean up before exiting:

trap 'echo "cleaning up"; rm -f "$tmp"; exit 1' TERM INT

Writing SIGTERM handlers properly is a crucial part of daemon development.

Related terms: Signal, SIGKILL, SIGHUP

Discussed in:

Also defined in: Textbook of Linux