Question or problem about Python programming:
I’m using django-gunicorn-nginx setup by following this tutorial http://ijcdigital.com/blog/django-gunicorn-and-nginx-setup/ Upto nginx setup, it is working. Then I installed supervisor, configured it and then I reboot my server and checked, it shows 502 bad gateway. I’m using Ubuntu 12.04 LTS
/etc/supervisor/conf.d/qlimp.conf
[program: qlimp] directory = /home/nirmal/project/qlimp/qlimp.sh user = nirmal command = /home/nirmal/project/qlimp/qlimp.sh stdout_logfile = /path/to/supervisor/log/file/logfile.log stderr_logfile = /path/to/supervisor/log/file/error-logfile.log
Then I restarted supervisor and I run this command $ supervisorctl start qlimp and I’m getting this error
unix:///var/run/supervisor.sock no such file
Is there any problem in my supervisor setup?
Thanks!
How to solve the problem:
Solution 1:
That there is no socket file probably means that supervisor isn’t running. A reason that it isn’t running might be that your qlimp.conf file has some sort of error in it. If you do a
sudo service supervisor start
you can see whether or not this is the case. If supervisor is already running, it will say. And if it is catching an error, it will usually give you a more helpful error message than supervisorctl.
Solution 2:
I have met the same issue as you and after several times, here comes the solution:
-
First remove the apt-get supervisor version:
sudo apt-get remove supervisor
-
Kill the backend supervisor process:
sudo ps -ef | grep supervisor
-
Then get the newest version(apt-get version was 3.0a8):
sudo easy_install(pip install) supervisor==3.0b2
-
Echo the config file(root premission):
echo_supervisord_conf > /etc/supervisord.conf
5.Start supervisord:
sudo supervisord
6.Enter supervisorctl:
sudo supervisorctl
Anything has been done! Have fun!
Solution 3:
Try this
cd /etc/supervisor sudo supervisord sudo supervisorctl restart all
Solution 4:
Are you sure that supervisord is installed and running? Is there a socket file in present at /var/run/supervisor.sock
?
The error indicates that supervisorctl
, the control CLI, cannot reach the UNIX socket to communicate with supervisord
, the daemon.
You could also check /etc/supervisor/supervisord.conf
and see if the values for the unix_http_server
and supervisorctl
sections match.
Note that this is a Ubuntu-level problem, not a problem with Python, Django or nginx and as such this question probably belongs on ServerFault.
Solution 5:
On Ubuntu 16+ it seems to been caused by the switch to systemd, this workaround may fix for new servers:
# Make sure Supervisor comes up after a reboot. $ sudo systemctl enable supervisor # Bring Supervisor up right now. $ sudo systemctl start supervisor
and then do check your status of iconic.conf [My example] of supervisor
$ sudo supervisorctl status iconic
PS: Make sure gunicorn should not have any problem while running.
Solution 6:
The error may be due to that you don’t have the privilege.
Maybe you can fix the error by this way, open your terminal, and input vim /etc/supervisord.conf
to edit the file, search the lines
[unix_http_server] ;file=/tmp/supervisor.sock ; (the path to the socket file) ;chmod=0700 ; socket file mode (default 0700)
and delete the Semicolon in the start of the string ;file=/tmp/supervisor.sock
and ;chmod=0700
, restart your supervisord. I suggest you do it.
Solution 7:
Make sure that in /etc/supervisor.conf
the following two sections exists
[unix_http_server] file=/tmp/supervisor.sock ; path to your socket file [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
Solution 8:
You can do something like this :-
sudo touch /var/run/supervisor.sock sudo chmod 777 /var/run/supervisor.sock sudo service supervisor restart
It’s definitely work, try this.
Solution 9:
In my case, Supervisor was not running. To spot the issue I run:
sudo systemctl status supervisor.service
The problem was that I had my logs pointing to a non-existing directory, so I just had to create it.
I hope it helps ๐
Solution 10:
touch /var/run/supervisor.sock sudo supervisord -c /etc/supervisor/supervisord.conf
and after
supervisorctl restart all
if you want to listen the supervisor port
ps -ef | grep supervisord
if you want kill the process
kill -s SIGTERM 2503