Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rawilk's avatar
Level 47

Automated supervisor install/configure bash script

First of all, please keep in mind that I'm just learning how to write bash scripts like this, so there might be something I'm overlooking or there are parts of the script could be written in a better way than I have them.

I have a CentOS 7 server and I wrote a bash script to install and configure supervisor automatically for you and optionally run migrations for the job tables. Everything works fine, except for the part that starts the supervisord service.

The script I'm using can be found here: https://github.com/rawilk/new-server-setup/blob/master/bash-scripts/laravel-queues.sh

When the script runs and gets to the part where it is supposed to start supervisord, it outputs the following error:

Failed to start supervisord.service: Unit not found.
error: <class 'socket.error'>, [Errno 2] No such file or directory: file: /usr/lib64/python2.7/socket.py line: 224
error: <class 'socket.error'>, [Errno 2] No such file or directory: file: /usr/lib64/python2.7/socket.py line: 224
unix:///var/run/supervisor/supervisor.sock no such file

What I find interesting about this is that if I run systemctl start supervisord after I run this script, it starts up just fine.

0 likes
2 replies
kbush's avatar
kbush
Best Answer
Level 18

Take a look at https://github.com/Supervisor/supervisor/issues/121#issuecomment-207699120

The error message given and the discussion seem to indicate a configuration or permissions issue.

I found another post that indicated the config file may be the issue as well and suggesting regenerating the config file using the following command

echo_supervisord_conf > /etc/supervisord.conf

Make sure the folders specified in the config file exist and have the correct permissions

rawilk's avatar
Level 47

I did implement some changes to my script based off that thread, but I think the real issue was with the server. I tried the script on a fresh server setup and it worked just fine.

1 like

Please or to participate in this conversation.