问题
This is my config flie.I run supervisord -c /etc/supervisor/supervisord.conf
it works well.
When I try to run supervisorctl -c /etc/supervisor/supervisord.conf
,the error happened:
Error: , Unknown protocol for serverurl /var/run/supervisord.sock: file: /usr/local/lib/python2.7/dist-packages/supervisor-3.0b2-py2.7.egg/supervisor/xmlrpc.py line: 440
I can start or stop my program through http://127.0.0.1:9001
perfectly,but I want to control the program in the command line.Anyone can help me?
[unix_http_server]
file = /var/run/supervisor.sock
chmod = 0777
chown= root:cruelcage
[inet_http_server]
port=9001
username = cruelcage
password = 123
[supervisorctl]
serverurl = /var/run/supervisord.sock
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisord]
logfile=/home/cruelcage/log/supervisord/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=true ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
#user=root ; (default is current user, required if root)
childlogdir=/home/cruelcage/log/supervisord/ ; ('AUTO' child log dir, default $TEMP)
[program:config]
command=python /home/cruelcage/documents/config/config.py
autostart = true
startsecs = 5
user = cruelcage
redirect_stderr = true
stdout_logfile_maxbytes = 20MB
stdoiut_logfile_backups = 20
stdout_logfile = /home/cruelcage/log/debug.log
回答1:
Your [supervisorctl]
serverurl
should be "unix:///var/run/supervisord.sock", since "/var/run/supervisord.sock" is not a valid URI for xmlrpclib
to connect to.
回答2:
echo_supervisord_conf > /etc/supervisord.conf
sudo supervisord -c /etc/supervisord.conf
sudo supervisorctl status
回答3:
I had this issue and found that it occurred after a server restart. When supervisor tried to restart afterwards, it couldn't find the log directory that was specified in my daemon config file (this problem didn't appear while supervisor was running).
All I needed to do was change the stdout_logfile path (or comment out the line) in my file:
(swap the ##### for your file id)
sudo nano /etc/supervisor/conf.d/daemon-#####.conf
Add an existing log file path or comment the line out with a # at the start of the line:
#stdout_logfile=/my/bad/log/directory
Then restart supervisor
sudo service supervisor restart
来源:https://stackoverflow.com/questions/20067116/supervisorctl-error-unix-var-run-supervisord-sock-refused-connection