GREPWISE

kill -9 is not a fix

A process cleans up after itself when it receives TERM. Sending KILL skips that entirely, so lock files, sockets and temporary state survive and the next start finds a mess.

kill -9 does not stop a process. It removes it.

A service hangs, you send kill -9, the process disappears, problem solved. Then the next start fails, or a stale lock file blocks everything, and nobody knows why.

Here is a worker that creates a lock file while it runs and removes it on shutdown. Send it TERM and it gets the chance to clean up, so the lock is gone. Start it again, send KILL instead, and the process is gone in the same instant, but the lock file is still sitting there. The signal never reaches the program, so its cleanup never runs.

KILL cannot be caught or ignored, which is exactly why nothing gets cleaned up. TERM asks, KILL removes. That leftover state is the mess you debug an hour later.

Send TERM first. Reach for KILL when nothing else works.

#linux#sysadmin#bash#devops#selfhosting

❯ Send TERM first. Reach for KILL when nothing else works.

cd ..