1   


2


3


4


5


6


7


8


9


10


11


12


13


14


15


16


17


18


19


20


21


22


23


24


25


26


27


28


29


30


31


32


33


34


35


36


37




启动命令:gunicorn backend.wsgi:application --bind 0.0.0.0:8000


 


​在工作中会发现gunicorn启动的web服务,无论怎么使用kill​​​​-​​​​9​​ ​​进程号都是无法杀死gunicorn,经过我一番百度和谷歌,发现想要删除gunicorn进程其实很简单。​


 


​第一步获取Gunicorn进程树:​


 


​通过执行如下命令,可以获取Gunicorn进程树:​


 


​pstree​​​​-​​​​ap|grep gunicorn​


​2.​​ ​​重启Gunicorn任务​


 


​Python​


​kill​​​​-​​​​HUP​​​​14226​


​3.​​ ​​退出Gunicorn任务​


 


​Python​


​kill​​​​-​​​​9​​ ​​28097​


​执行上述命令后,再次执行“pstree​​​​-​​​​ap|grep gunicorn”,我们很容易发现,除了主进程,其他的Gunicorn进程都已经销毁,并新建了进程(进程​​​​ID​​​​发生了变化)。​