3 ms·
As already stated, a process cannot respond to KILL signal, not allowing it to cleanup after itself. In many cases this may be OK or irrelevant, but you should
by atbattag 11y ago
As already stated, a process cannot respond to KILL signal, not allowing it to cleanup after itself. In many cases this may be OK or irrelevant, but you should never use -9 as a first resort. -9 is a last resort.
Ever kill -9 an unresponsive rails server process only to find that you have to manually rm the tmp server.pid file? That's because you used -9 ;).
- mhartl 11y agoSo would it be reasonable to recommend kill $pid as a first step and kill -9 $pid if that doesn't work? Bear in mind that this is a tutorial for beginners, so things like kill -15 $pid || kill -2 $pid || kill -1 $pid || kill -9 $pid (as another commenter suggested) aren't appropriate, but I feel like kill is too important a command to leave out completely.
- userbinator 11y agoOn the other hand, it seems almost all the times when I've had to use kill it's because the process has already refused to die by more normal means and I doubt it'd respond to a non-9 kill.