Created
October 3, 2023 08:32
-
-
Save MortenDHansen/56fb0692b5a40b7e368f9c0e8694fe7c to your computer and use it in GitHub Desktop.
Install supervisor on Amazon Linux 2023 (al2023 elastic beanstalk)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Supervisor - starting setup" | |
. /opt/elasticbeanstalk/deployment/env | |
if ! command -v supervisord &> /dev/null | |
then | |
echo "installing supervisor" | |
sudo yum update -y && sudo yum install python3 python3-pip -y | |
sudo pip install supervisor | |
echo_supervisord_conf | sudo tee -a /etc/supervisord.conf | |
else | |
echo "supervisor already installed" | |
fi | |
if [ ! -d /etc/supervisor ]; then | |
sudo mkdir /etc/supervisor | |
echo "create supervisor directory" | |
fi | |
if [ ! -d /etc/supervisor/conf.d ]; then | |
mkdir /etc/supervisor/conf.d | |
echo "create supervisor configs directory" | |
fi | |
# Maybe add your own config instead of the default added on line 11 | |
# . /opt/elasticbeanstalk/deployment/env && cat .ebextensions/supervisor/supervisord.conf > /etc/supervisor/supervisord.conf | |
if ps aux | grep "[/]supervisord"; then | |
echo "supervisor is running" | |
else | |
echo "starting supervisor" | |
supervisord | |
fi | |
supervisorctl reread | |
supervisorctl update | |
echo "Supervisor Running!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment