Don’t Use kill -9

When I was starting out as a sysadmin I would hear and read “don’t use kill -9” all the time. But rarely did anyone explain that to do instead.

I saw this the other day and liked it. Randal Schwartz, who wrote many of the Perl books those of us who were sysadmins in the 90s and 00s lived by, would post this to lists.

No no no. Don’t use kill -9.

It doesn’t give the process a chance to cleanly:

1) shut down socket connections

2) clean up temp files

3) inform its children that it is going away

4) reset its terminal characteristics

and so on and so on and so on.

Generally, send 15, and wait a second or two, and if that doesn’t work, send 2, and if that doesn’t work, send 1. If that doesn’t, REMOVE THE BINARY because the program is badly behaved!

Don’t use kill -9. Don’t bring out the combine harvester just to tidy up the flower pot.

This is great advice and one of the rare times you see a followup to the “don’t use kill -9” mantra.