Supervisor无法启动进程

发布于 2022-09-11 17:58:21 字数 2403 浏览 17 评论 0

我用Supervisor做进程控制

/etc/supervisor/conf.d/onehomeServer.conf

[program:onehomeServer]
command=sudo /home/fanfei/onehomeServer/env/bin/gunicorn --bind unix:/tmp/www.fanfei.site.socket onehomeServer.asgi:application
directory=/home/fanfei/onehomeServer/               ; 执行前要不要先cd到目录$
autostart=true                ; 随着supervisord的启动而启动
autorestart=true              ; 自动重启。。当然要选上了
startretries=10               ; 启动失败时的最多重试次数
exitcodes=0                   ; 正常退出代码
stopsignal=KILL               ; 用来杀死进程的信号
stopwaitsecs=10               ; 发送SIGKILL前的等待时间
redirect_stderr=true          ; 重定向stderr到stdout
stdout_logfile=/home/fanfei/onehomeServer/logfile.log        ; 指定日志文件
; 默认为 false,如果设置为 true,当进程收到 stop 信号时,会自动将该信号发给该进$
stopasgroup=true             ; send stop signal to the UNIX process
; 默认为 false,如果设置为 true,当进程收到 kill 信号时,会自动将该信号发给该进$
killasgroup=true             ; SIGKILL the UNIX process group (def false)

但是,当我执行

sudo supervisorctl reload

sudo supervisorctl restart all

以后,网站是打不开的。日志文件如下:

[2019-02-27 10:32:40 +0800] [1323] [INFO] Starting gunicorn 19.9.0
[2019-02-27 10:32:40 +0800] [1323] [INFO] Listening at: unix:/tmp/www.fanfei.site.socket (1323)
[2019-02-27 10:32:40 +0800] [1323] [INFO] Using worker: sync
[2019-02-27 10:32:40 +0800] [1326] [INFO] Booting worker with pid: 1326
[2019-02-27 10:32:59 +0800] [1337] [INFO] Starting gunicorn 19.9.0
[2019-02-27 10:32:59 +0800] [1337] [INFO] Listening at: unix:/tmp/www.fanfei.site.socket (1337)
[2019-02-27 10:32:59 +0800] [1337] [INFO] Using worker: sync
[2019-02-27 10:32:59 +0800] [1340] [INFO] Booting worker with pid: 1340

如果我在命令行直接执行

sudo /home/fanfei/onehomeServer/env/bin/gunicorn --bind unix:/tmp/www.fanfei.site.socket onehomeServer.wsgi:application

网站可以打开:

[2019-02-27 09:41:56 +0800] [1143] [INFO] Starting gunicorn 19.9.0
[2019-02-27 09:41:56 +0800] [1143] [INFO] Listening at: unix:/tmp/www.fanfei.site.socket (1143)
[2019-02-27 09:41:56 +0800] [1143] [INFO] Using worker: sync
[2019-02-27 09:41:56 +0800] [1146] [INFO] Booting worker with pid: 1146
^C[2019-02-27 09:42:42 +0800] [1143] [INFO] Handling signal: int
[2019-02-27 09:42:42 +0800] [1146] [INFO] Worker exiting (pid: 1146)
[2019-02-27 09:42:43 +0800] [1143] [INFO] Shutting down: Master

请问是哪里的问题

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

简单 2022-09-18 17:58:21

注意前后命令不一致

sudo /home/fanfei/onehomeServer/env/bin/gunicorn --bind unix:/tmp/www.fanfei.site.socket onehomeServer.asgi:application
sudo /home/fanfei/onehomeServer/env/bin/gunicorn --bind unix:/tmp/www.fanfei.site.socket onehomeServer.wsgi:application
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文