保留不会停止

ear*_*ian 5 python pyramid

我刚接触金字塔和保护区,但是碰到一堵砖墙,试图在不破坏进程的情况下停止保护区。

我可以按以下方式在生产模式下启动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
Run Code Online (Sandbox Code Playgroud)

但是当我尝试停止它时,如下所示:

/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
Run Code Online (Sandbox Code Playgroud)

我收到一个错误:

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
Run Code Online (Sandbox Code Playgroud)

有什么想法为什么停止命令不起作用?如果可以的话,它在linux ubuntu盒上。

ura*_*ash 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
Run Code Online (Sandbox Code Playgroud)

2)创建pyramid.pid

touch pyramid.pid && echo "26795" >> pyramid.pid
Run Code Online (Sandbox Code Playgroud)

3)停止保存:)

/home/testuser/.virtualenvs/testapp/bin/python /home/testuser/.virtualenvs/testapp/bin/pserve production.ini stop
Run Code Online (Sandbox Code Playgroud)