What if 'kill -9' does not work? or How to kill a script which starts new processes? doesn't help me in anyway.
I have a python script which starts automatically with another process id using the same port when killed using sudo kill -9 <pid>.
$ lsof -i :3002 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME python 13242 ubuntu 3u IPv4 64592 0t0 TCP localhost:3002 (LISTEN) $ sudo kill -9 13242 $ lsof -i :3002 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME python 16106 ubuntu 3u IPv4 74792 0t0 TCP localhost:3002 (LISTEN) $ sudo kill 16106 $ lsof -i :3002 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME python 16294 ubuntu 3u IPv4 75677 0t0 TCP localhost:3002 (LISTEN) It's not a Zombie process.
$ ps -Al 4 S 0 16289 1 0 80 0 - 12901 poll_s ? 00:00:00 sudo 4 S 1000 16293 16289 0 80 0 - 1100 wait ? 00:00:00 sh 0 S 1000 16294 16293 0 80 0 - 34632 poll_s ? 00:00:00 python I have even tried sudo pkill -f <processname> with no luck. It doesn't want to die.
Update:
It's parent process is sh whose parent is sudo as mentioned in the above table. I am not sure if it is safe to kill these abruptly. Also this is a shared ubuntu server.
lsofoutput shows a new pid every single time. The process is simply restarting.