Skip to content

Instantly share code, notes, and snippets.

@dasgoll
Last active March 18, 2021 15:19
Show Gist options
  • Save dasgoll/e792fe1a811439e6fe114d79ac905016 to your computer and use it in GitHub Desktop.
Save dasgoll/e792fe1a811439e6fe114d79ac905016 to your computer and use it in GitHub Desktop.
Install supervisord on Amazon Linux / CentOS
yum install python-setuptools
easy_install supervisor
/usr/local/bin/supervisord --version
/usr/local/bin/echo_supervisord_conf > /etc/supervisord.conf
vim /etc/init.d/supervisord
chmod 755 /etc/init.d/supervisord
## OR
yum install -y supervisor --enablerepo=epel
vim /etc/supervisord.conf
files = supervisor/conf.d/*.conf
mkdir -p /etc/supervisor/conf.d
vim /etc/supervisor/conf.d/yourapp.conf
useradd search-queue
[program:search-queue]
command=/usr/bin/java -jar /mnt/code/indexer/queue/target/IndexerServer-1.0.0.jar --spring.config.location=file:/mnt/code/indexer/queue/config/prod_application.properties,file:/mnt/code/indexer/queue/config/prod_ActiveMQConfig.properties,file:/mnt/code/indexer/queue/config/prod_RestClientConfig.properties
user=search-queue
autostart=true
autorestart=true
startsecs=10
startretries=3
stdout_logfile=/var/log/search-queue-stdout.log
stderr_logfile=/var/log/search-queue-stderr.log
/etc/init.d/supervisord start
supervisorctl start search-queue
#!/bin/bash
. /etc/init.d/functions
DAEMON=/usr/local/bin/supervisord
PIDFILE=/var/run/supervisord.pid
[ -x "$DAEMON" ] || exit 0
start() {
echo -n "Starting supervisord: "
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
echo supervisord already running: $PID
exit 2;
else
daemon $DAEMON --pidfile=$PIDFILE -c /etc/supervisord.conf
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/supervisord
return $RETVAL
fi
}
stop() {
echo -n "Shutting down supervisord: "
echo
killproc -p $PIDFILE supervisord
echo
rm -f /var/lock/subsys/supervisord
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status supervisord
;;
restart)
stop
start
;;
*)
echo "Usage: {start|stop|status|restart}"
exit 1
;;
esac
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment