You must start gradually, and then move on to the difficult thing to kill the process if it does not want to play beautifully.
The SIGKILL (-9) signal cannot be detected, and this will mean that any resources held by the process will not be cleared.
First try using SIGTERM (-15), and then check for the existence of the process by running kill -0 $ (cat pid). If he still hangs around, then, by all means, knocks him down with -9.
SIGTERM can be captured by a process, and any process that has been correctly written must have a signal handler to catch SIGTERM and then clear its resources before exiting.
Rob wells
source share