我使用uwsgi,supervisor和nginx部署我的django项目。 但是我在/etc/supervisord.conf中添加了我上面的程序。
[program:JZAssist]
command=-E uwsgi --ini /home/work/xxxx/uwsgi.ini
directory=/home/work/xxxx
startsecs=0
stopwaitsecs=0
autostart=true
autorestart=true
我的uwsgi.ini内容是:
[uwsgi]
socket = :8000
chdir = /home/work/xxxx
module = xxxx.wsgi
master = true
processes = 4
vacuum = true
xxxx是我的项目名称。
我在cmd中运行supervisorctl -c /etc/supervisord.conf restart all
。
它显示了
xxxx: ERROR (no such file)
/tmp/supervisord.log内容的一部分:
2017-02-24 23:31:41,433 INFO gave up: JZAssist entered FATAL state, too many start retries too quickly
2017-02-24 23:52:29,940 WARN Failed to clean up '/tmp/JZAssist-stderr---supervisor-goPZyS.log'
2017-02-24 23:52:29,940 WARN Failed to clean up '/tmp/JZAssist-stdout---supervisor-WtfJcp.log'
2017-02-24 23:52:57,535 WARN Failed to clean up '/tmp/JZAssist-stderr---supervisor-goPZyS.log'
2017-02-24 23:52:57,535 WARN Failed to clean up '/tmp/JZAssist-stdout---supervisor-WtfJcp.log'
2017-02-24 23:52:57,541 INFO RPC interface 'supervisor' initialized
2017-02-24 23:52:57,541 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-02-24 23:52:57,542 INFO daemonizing the supervisord process
2017-02-24 23:52:57,543 CRIT could not write pidfile /tmp/supervisord.pid
2017-02-24 23:52:58,544 INFO spawnerr: can't find command '-E'
2017-02-24 23:52:59,546 INFO spawnerr: can't find command '-E'
2017-02-25 00:46:59,234 WARN Failed to clean up '/tmp/JZAssist-stderr---supervisor-goPZyS.log'
2017-02-25 00:46:59,234 WARN Failed to clean up '/tmp/JZAssist-stdout---supervisor-WtfJcp.log'
我不知道为什么会报告这样的错误。我可以使用runserver.so运行我的django项目,该文件丢失了什么?
答案 0 :(得分:4)
在freepdk45
行上,您已将程序指定为command=
,主管无法执行该程序。
为作业创建文件时,命令行应该作为shell命令执行,并且不应该依赖于给定shell的内部命令。例如,我遇到了一个开头的问题:
-E
但source /path/to/python/virtual/environment/bin/activate && ...
是内置的bash。我需要将其改为:
source
这样,主管可以找到并运行的可执行文件是bash -c 'source /path/to/python/virtual/environment/bin/activate && ...
。
在你的情况下,似乎uwsgi应该是bash
之后的第一件事。
您提到您在运行command=
时使用-E
标志来保留环境变量,但主管不需要sudo
答案 1 :(得分:0)
我遇到了这个错误消息,但在我的例子中,我在我的作业定义中指定了一个没有在服务器上创建的用户。
[program:my-task]
user=this-user-didnt-exist