Question

$ supervisorctl reread
error: <class 'socket.error'>, [Errno 111] Connection refused: file: /usr/lib64/python2.6/socket.py line: 567

I'm trying to configure supervisor on my production system, but am hitting this error. The supervisor log file is empty.

When I just type supervisorctl, it complains:

http://localhost:9001 refused connection

Nothing is currently listening on port 9001, AFACT: lsof | grep TCP returns nothing.

Was it helpful?

Solution

You have to start supervisord before you can use supervisorctl. In my case:

sudo supervisord -c /etc/supervisor/supervisord.conf
sudo supervisorctl -c /etc/supervisor/supervisord.conf

OTHER TIPS

If you started supervisord with a custom path, like this:

sudo supervisord -c /mypath/supervisord.conf

Then you should also start supervisorctl with the same parameter, like this:

sudo supervisorctl -c /mypath/supervisord.conf

You can get this issue if you start supervisor with a relative url for -c and then try run supervisorctl from a different directory.

For example:

supervisord -c supervisord.conf
supervisorctl start someapp ## works 
cd somedirectory
supervisorctl restart someapp ## http://localhost:9001 refused connection

Solution would be to always use the absolute path. e.g.:

Good:

supervisord -c /etc/supervisor/supervisord.conf

Bad:

supervisord -c supervisord.conf

This issue also occurs when an old vesion of supervisord.conf file is used. Newer version of supervisor uses different configuration file. The above solutions don't work. In this case you just have to regenerate the configuration file with

echo_supervisord_conf > /etc/supervisord.conf

Hope it helps someoone.

please do the following :

sudo service supervisor start

post which everything is normal as b4 - there is a problem with 1b version

sudo supervisorctl reload

In Ubuntu 18.04 with distribution's package

You probably did the same mistake as me an created the config file /etc/supervisord.conf while my service manager (systemd) was using the config file /etc/supervisor/supervisord.conf

sudo rm /etc/supervisord.conf

Or

sudo mv /etc/supervisord.conf /etc/supervisor/supervisord.conf

if you want to keep it

Now you can run sudo supervisorctl


Why?

when you run supervisorctl it first searches for the config file located at /etc/supervisord.conf, if it's not present, it will search for the package's default file /etc/supervisor/supervisord.conf this is the one systemd actually runs.

Systemd always use the file /etc/supervisor/supervisord.conf regardless of the other file's existence.

You can check which file is using systemd by running sudo systemctl status supervisor

enter image description here You can see in the last line the command where the config file is hardcoded

both supervisord and supervisorctl use -c with absolute config file path, make sure both commands startup with same config.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top