Why should you send SIGTERM before SIGKILL?
BeginnerConceptProcesses, Signals & systemd
Answer
SIGTERM lets the process run its handler: finish in-flight requests, flush buffers, close DB connections, remove lock files. SIGKILL ends it instantly with no cleanup, risking corrupted data and leftover locks. systemd and Kubernetes both send SIGTERM, wait a grace period (TimeoutStopSec, terminationGracePeriodSeconds), and only then SIGKILL.
More on Processes, Signals & systemd
What is the difference between a program, a process and a thread?BeginnerHow are new processes created in Linux?IntermediateWhat is a zombie process, and how do you get rid of it?IntermediateWhat is an orphan process?BeginnerExplain the process states shown in ps (R, S, D, T, Z).IntermediateWhy can't you kill a process in D state?Advanced