如何在virtualenv中停止gunicorn_django?
我正在尝试 Gunicorn,并将其安装在带有 django 站点的 virtualenv 中。我用这个命令运行了gunicorn:
gunicorn_django -b 127.0.0.1:9000
这一切都很好。我还没有设置 bash 脚本或将其连接到 upstart(我在 Ubuntu 上),因为我正在测试它。
与此同时,我与服务器的连接中断了,因此我失去了控制台,并且在重新连接后我无法再使用 CTRL + C 来停止服务器。
当gunicorn_django已经运行时,如何停止它?
I am trying out gunicorn, and I installed it inside a virtualenv with a django site. I got gunicorn running with this command:
gunicorn_django -b 127.0.0.1:9000
Which is all well and good. I haven't setup a bash script or hooked it to upstart (I am on Ubuntu) yet, because I am testing it out.
Meantime, my connection to the server was broken, and thus I lost the console, and I can no longer do CTRL + C to stop the server after reconnecting.
How do I stop gunicorn_django, when it is already running?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
解决此类问题的一般方法是执行
ps ax|grep Gunicorn
查找相关进程,然后执行kill xxxx
其中 xxxx 是第一列中的数字。The general solution to problems like this is to do
ps ax|grep gunicorn
to look for the relevant process, then dokill xxxx
where xxxx is the number in the first column.刚刚还发现了这个 -
pkill
- 这将杀死与搜索文本匹配的所有进程:不知道它的支持程度如何,但可以确认它可以在 Ubuntu 12.04 上运行
(来自 http://www.howtogeek.com/howto/linux/kill-linux-processes -更容易-with-pkill/)
Just found this also -
pkill
- which will kill all processes matching the search text:No idea how well supported it is, but can confirm that it works on Ubuntu 12.04
(from http://www.howtogeek.com/howto/linux/kill-linux-processes-easier-with-pkill/)
更快的方法:
更新代码
A faster way:
updated code
这是一个刚刚在此处修复的错误。
This was a bug that has just been fixed here.