Pserve不会停止

时间:2013-11-15 21:52:44

标签: python pyramid

我对金字塔和pserve很新,但我遇到了一堵砖墙试图阻止pserve而不仅仅是杀死进程。

我可以按如下方式在生产模式下启动pserve:

/usr/bin/python /usr/local/bin/pserve /var/mypath/production.ini start --daemon --pid-file=/var/lock/watermark.pid --log-file=/var/www/5000.log --monitor-restart http_port=8080

但是当我试图按如下方式阻止它时:

/usr/bin/python /usr/local/bin/pserve /var/mypath/production.ini stop --daemon --pid-file=/var/lock/watermark.pid --log-file=/var/www/5000.log --monitor-restart http_port=8080

我收到错误:

Traceback (most recent call last):
  File "/usr/local/bin/pserve", line 8, in <module>
    load_entry_point('pyramid==1.5a2', 'console_scripts', 'pserve')()
  File "/usr/local/lib/python2.7/dist-packages/pyramid-1.5a2-py2.7.egg/pyramid/scripts/pserve.py", line 51, in main
    return command.run()
  File "/usr/local/lib/python2.7/dist-packages/pyramid-1.5a2-py2.7.egg/pyramid/scripts/pserve.py", line 229, in run
    result = self.stop_daemon()
  File "/usr/local/lib/python2.7/dist-packages/pyramid-1.5a2-py2.7.egg/pyramid/scripts/pserve.py", line 476, in stop_daemon
    kill(pid, signal.SIGTERM)
OSError: [Errno 3] No such process

为什么stop命令不起作用的任何想法?如果它有所作为,那就是在linux的ubuntu盒子上。

1 个答案:

答案 0 :(得分:0)

1)获取流程数

ps -ef | grep pserve
testuser 26795     1  0 04:18 ?        00:00:00 /home/testuser/.virtualenvs/testapp/bin/python /home/testuser/.virtualenvs/testapp/bin/pserve production.ini start --daemon --pid-file=watermark.pid --log-file=5000.log --monitor-restart http_port=8080

2)创建pyramid.pid

touch pyramid.pid && echo "26795" >> pyramid.pid

3)停止保存:)

/home/testuser/.virtualenvs/testapp/bin/python /home/testuser/.virtualenvs/testapp/bin/pserve production.ini stop