Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example configuration file for supervisord.conf
file=/tmp/supervisor.sock ; path to your socket file
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/ ; pidfile location
nodaemon=false ; run supervisord as a daemon
minfds=1024 ; number of startup file descriptors
minprocs=200 ; number of process descriptors
user=root ; default user
childlogdir=/var/log/supervisord/ ; where child log files will live
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
; This is where you run individual Tornado instances.
; We run four; one per processor core.
; In development, we ran as many as four per core with no issues.
; If you're looking to minimize cpu load, run fewer processes.
; BTW, Tornado processes are single threaded.
; To take advantage of multiple cores, you'll need multiple processes.
command=/path/to/ --port=8000
stderr_logfile = /var/log/supervisord/tornado-stderr.log
stdout_logfile = /var/log/supervisord/tornado-stdout.log
command=/path/to/ --port=8001
stderr_logfile = /var/log/supervisord/tornado-stderr.log
stdout_logfile = /var/log/supervisord/tornado-stdout.log
command=/path/to/ --port=8002
stderr_logfile = /var/log/supervisord/tornado-stderr.log
stdout_logfile = /var/log/supervisord/tornado-stdout.log
command=/path/to/ --port=8003
stderr_logfile = /var/log/supervisord/tornado-stderr.log
stdout_logfile = /var/log/supervisord/tornado-stdout.log

This comment has been minimized.

Copy link

@hunt3r hunt3r commented Mar 29, 2014

Have you created a startup script to utilize this? I solved this without supervisor using standard bash techniques, but am considering porting my solution over to supervisor based but need to be able to start on sever restart via chkconfig on centos.


This comment has been minimized.

Copy link

@ghost ghost commented May 20, 2014

@hunt3r: I solve the problem i believe you are having, by doing the following (am currently using the Amazon Linux AMI on EC2 which is loosely based on CentOS):

all as root user:

  1. create a virtualenv for supervisor
  2. activate virtualenv and install supervisor via pip
  3. write the main supervisord.conf file to /etc/supervisord.conf
  4. optionally create dir /etc/supervisord.d and put supervisor configs in there (all of my configs have user var specified as non-root user)
  5. save the following to /etc/init.d/supervisord:


Amazon Linux AMI startup script for a supervisor instance

chkconfig: 2345 80 20

description: Autostarts supervisord.

derived from:

Source function library.

. /etc/rc.d/init.d/functions

supervisor_start="$supervisord -c $config_file"
supervisor_stop="$supervisorctl shutdown"
[ -f $supervisord ] || exit 1
[ -f $supervisorctl ] || exit 1
start() {
echo -n "Starting $name: "
return $RETVAL
stop() {
echo -n "Stopping $name: "
return $RETVAL
case "$1" in
exit $REVAL
6. chmod +x /etc/init.d/supervisord
7. chkconfig —add supervisord
8. chkconfig supervisord on
9. service supervisord start

Hope this helps!


This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment