supervisorctl 3.3.1 不工作,抱怨找不到 .conf 文件

supervisorctl 3.3.1 not working, complaining about not finding .conf file

root@dev-demo-karl:~# supervisord -v
3.3.1

我在尝试访问 supervisorctl 时遇到以下错误:

Error: .ini file does not include supervisorctl section
For help, use /usr/bin/supervisorctl -h

主管没有使用配置文件

root@dev-demo-karl:/srv/www# /usr/bin/supervisorctl
Error: .ini file does not include supervisorctl section
For help, use /usr/bin/supervisorctl -h
root@dev-demo-karl:/srv/www# cd /etc/              
root@dev-demo-karl:/etc# cat supervisor
supervisor/       supervisord/      supervisord.conf
root@dev-demo-karl:/etc# ls supervisord/conf.d                  
supervisord.conf
root@dev-demo-karl:/etc# ls supervisor/conf.d
supervisord.conf
root@dev-demo-karl:/etc# ls supervisord       
conf.d  supervisord.conf
root@dev-demo-karl:/etc# ls supervisor
conf.d  supervisord.conf

所有 supervisord.conf 文件都有以下内容:

root@dev-demo-karl:/etc# cat supervisord.conf 
[supervisord]
nodaemon=true

[program:node]
directory=/srv/www
command=npm run demo
autostart=true
autorestart=true

[program:mongod]
command=/usr/bin/mongod --auth --fork --smallfiles --logpath /var/log/mongodb.log

KNOW supervisord 正在寻找其中之一,因为服务已启动:

root@dev-demo-karl:~# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.8  47624 17744 ?        Ss   21:03   0:00 /usr/bin/python /usr/bin/supervisord
root         8  0.1  2.4 1003400 49580 ?       Sl   21:03   0:00 npm
root        16  0.6  2.3 295224 48192 ?        Sl   21:03   0:03 /usr/bin/mongod --auth --fork --smallfiles --logpath /var/log/mongodb.log
root        40  0.0  0.0   4512   844 ?        S    21:03   0:00 sh -c npm run prod
root        41  0.1  2.4 1003412 49584 ?       Sl   21:03   0:00 npm
root        52  0.0  0.0   4512   712 ?        S    21:03   0:00 sh -c NODE_ENV=production NODE_PATH="$(pwd)" node src/index.js
root        54  0.4  8.1 1068568 166080 ?      Sl   21:03   0:02 node src/index.js
root        79  0.0  0.1  18240  3248 ?        Ss+  21:04   0:00 bash
root       238  0.0  0.1  18248  3248 ?        Ss   21:06   0:00 bash
root       501  0.0  0.1  34424  2884 ?        R+   21:12   0:00 ps aux

为什么 supervisorctl 不工作?

最后一个:

root@dev-demo-karl:~# cat /etc/supervisord.conf
[supervisord]
nodaemon=true

[program:node]
directory=/srv/www
command=npm run demo
autostart=true
autorestart=true

[program:mongod]
command=/usr/bin/mongod --auth --fork --smallfiles --logpath /var/log/mongodb.log
root@dev-demo-karl:~# supervisorctl -c /etc/supervisord.conf
Error: .ini file does not include supervisorctl section
For help, use /usr/bin/supervisorctl -h

什么?有人知道我做错了什么吗?我通过 Docker 容器中的命令启动它:

CMD ["/usr/bin/supervisord"]

Supervisor 在 3.3.1 版本中增加了一些必填字段。 http://supervisord.org/configuration.html

我添加了它们,现在已阅读!

一、如何启动supervisord:

# Start server
supervisord -c /path/to/supervisor.conf
# Then use client
supervisorctl -c /path/to/supervisor.conf status

二、典型配置(work for me supervisord --v -> 4.1.0)

[inet_http_server]
port = 127.0.0.1:9001

[supervisorctl]
serverurl = http://127.0.0.1:9001

[program:<your_program_name>]

[unix_http_server]
file=/tmp/supervisor.sock

[supervisord]
nodaemon=true
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = 
supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock

[program:<your_program_name>]
...

p.s。我已经回答了这个 post,因为它首先出现在 google 搜索中。)