Bash – When will kill PID fail

bashkill

I'm trying to kill 31216 31617,but after 10 times,that process still survives.

Why?

Is there a way to force it dead?

root     31216     1  0 10:49 ?        00:00:00 nginx: master process /root/nginx-1.0.2/objs/nginx -c /root/nginx-1.0.2/conf/nginx.conf
nobody   31217 31216  0 10:49 ?        00:00:00 [nginx] <defunct>

Best Answer

When you are killing a process with a kill pid, you are sending a SIGTERM. Sometimes a process is stuck in a state where it won't listen to signals. When that happens, try kill -9 pid and that will probably kill it for good.

In this case, the defunct process (31217) won't be able to be killed, but the parent process (31216) should die and take its child process with it.