Search code examples
pythonbashprocesstornado

How to kill multiple tornado processes at one time?


I used nohup python *.py & to run my tornado web service, and 8 processes started.

.

However, it is really annoying killing my tornado processes. I have to ues kill -3 pid 8 times to finally turn down my service. So I want to know how can I kill the 8 processes at one time in my bash? Thanks.

I tried killall python, but it is dangerous when there is other python process running.

@Viktor suggest me to use pkill -P <parent> and it works in my Ubuntu. But in Centos, 'pkill' doesn't work. So how can I 'pkill' the processes in Centos? Thanks.


Solution

  • This depends on your environment a bit.

    But you may want to look into pkill -P <parent>, which kills everything with the same parent pid.