怎样重启Gunicorn

首先给大家分享一个巨牛巨牛的人工智能教程,是我无意中发现的。教程不仅零基础,通俗易懂,而且非常风趣幽默,还时不时有内涵段子,像看小说一样,哈哈~我正在学习中,觉得太牛了,所以分享给大家!点这里可以跳转到教程

                    

1. 寻找masterpid

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

pstree -ap|grep gunicorn
  
  
  • 1

得到如下的结果。

|-grep,6194 --col gunicorn  |   `-gunicorn,30080 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,4413 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,8030 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,8135 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,8137 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,11532 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,13460 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,19728 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,23585 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,23825 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,27921 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,28899 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,28900 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,28901 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,35637 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,36963 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,43074 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,43118 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,43232 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,43307 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,43308 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,44018 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,46996 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       |-gunicorn,47000 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py  |       `-gunicorn,47650 /usr/local/bin/gunicorn collect:app -c collect_gunicorn.py
  
  
  • 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

很显然,30080就是Gunicorn的主进程。

2. 重启Gunicorn任务

按照官方的推荐方法,很容易执行命令:

#   不需要sudokill -HUP 30080
  
  
  • 1
  • 2

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

           

浏览人工智能教程

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值