Sunday, 1 March 2009

restarting a process using kill

Never use kill -9 , except for the last resort.

The -9 (or -KILL) argument to kill(1) should never be used on Unix systems, except as a very last resort. Why? The KILL signal does not allow a process to run any cleanup code, which means blasting away with kill -9 may leave child processes of a parent orphaned, temporary files strewn about, shared memory segments active, and lingering sockets. This leaves the system in a needlessly messy state, and could lead to unanticipated and hard to debug problems.
Instead, use the TERM signal by default, and only work up to a KILL if less problematic signals prove insufficient:

$ kill -HUP 6738 is safe and restarts the process by re-reading the configuration

No comments:

Post a Comment

Tweets by @sriramperumalla