我试图用supervisord
停止NGINX
时遇到错误。Supervisord - NGINX停止OSError
要启动NGINX
没有错误从supervisord
我曾在supervisord.conf
前面加上sudo
到nginx的命令:
[supervisord]
[program:nginx]
command=sudo nginx -c %(ENV_PWD)s/configs/nginx.conf
当我运行此:
使用supervisorctl
何时停止过程
$ supervisord -n
2017-02-09 12:26:06,371 INFO RPC interface 'supervisor' initialized
2017-02-09 12:26:06,372 INFO RPC interface 'supervisor' initialized
2017-02-09 12:26:06,372 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-02-09 12:26:06,373 INFO supervisord started with pid 22152
2017-02-09 12:26:07,379 INFO spawned: 'nginx' with pid 22155
2017-02-09 12:26:08,384 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
^C# SIGINT: Should stop all processes
2017-02-09 13:59:08,550 WARN received SIGINT indicating exit request
2017-02-09 13:59:08,551 CRIT unknown problem killing nginx (22155):Traceback (most recent call last):
File "/Users/ocervell/.virtualenvs/ndc-v3.3/lib/python2.7/site-packages/supervisor/process.py", line 432, in kill
options.kill(pid, sig)
File "/Users/ocervell/.virtualenvs/ndc-v3.3/lib/python2.7/site-packages/supervisor/options.py", line 1239, in kill
os.kill(pid, signal)
OSError: [Errno 1] Operation not permitted
同:
$ supervisorctl stop nginx
FAILED: unknown problem killing nginx (22321):Traceback (most recent call last):
File "/Users/ocervell/.virtualenvs/ndc-v3.3/lib/python2.7/site-packages/supervisor/process.py", line 432, in kill
options.kill(pid, sig)
File "/Users/ocervell/.virtualenvs/ndc-v3.3/lib/python2.7/site-packages/supervisor/options.py", line 1239, in kill
os.kill(pid, signal)
OSError: [Errno 1] Operation not permitted
有没有解决方法?
问题是,你为什么要在监督下启动nginx?它守护进程,这意味着它退出,supervisord会检测到失败(不是)。它必须与sudo一起运行,因为它绑定到低端口号(80和443)。重新考虑你监督守护进程的决定。为了让nginx运行,所以主管可以完成它的工作,你必须告诉它不要守护进程。 [请参考nginx文档](http://nginx.org/en/docs/faq/daemon_master_process_off.html)。 –
启动nginx工程,我在nginx配置中关闭了'daemon'。问题是如何与主管一起杀死它。我想用supervisor启动/停止nginx的原因是,我需要为所有正在运行的进程(webservers,redis,rabbitmq等)启用/关闭开关,包括nginx。 –
试图在黑暗中刺伤 - “sudo supervisorctl stop nginx”,你试过了吗? –