Every supervisord option, explained
Each program setting, its default, and what changes when you change it.

A supervisord program file is only a dozen lines, but each line changes how your program starts, stops, restarts or logs, and a few of the defaults catch people out. This guide goes through every setting supervisord accepts, grouped by what it controls: the default, what it does, and what happens when you change it.
The examples lean on Laravel, because queue workers are what most people run under supervisord, and the Laravel notes are set apart so you can find them. Every setting works the same for any program. The defaults come from supervisord 4.2.5’s source and its configuration docs; 4.3.0, the latest release, didn’t change any program settings.
At a glance
Every setting a [program:x] section takes, in the order this guide covers them:
| Setting | Default | What it does |
|---|---|---|
command | none, required | The program to run, with its arguments. |
directory | supervisord’s folder | The folder it starts in. |
user | supervisord’s user | The user it runs as. |
environment | nothing added | Extra environment variables. |
umask | supervisord’s | The permissions of files it creates. |
numprocs | 1 | How many copies to run. |
process_name | %(program_name)s | The name of each copy. |
autostart | true | Starts it when supervisord starts. |
startsecs | 1 | How long it has to stay up to count as started. |
startretries | 3 | How many failed starts before supervisord gives up. |
priority | 999 | The order programs start and stop in. |
autorestart | unexpected | Whether it starts again when it exits. |
exitcodes | 0 | The exit codes that count as expected. |
stopsignal | TERM | The signal that asks it to stop. |
stopwaitsecs | 10 | How long to wait before killing it. |
stopasgroup, killasgroup | false | Whether its child processes get the signal too. |
redirect_stderr | false | Writes errors into the output log. |
stdout_logfile, stderr_logfile | AUTO | Where output and errors are written. |
*_logfile_maxbytes, *_logfile_backups | 50MB, 10 | When logs rotate, and how many old ones to keep. |
stdout_syslog, stderr_syslog | false | Also sends output to syslog. |
numprocs_start, serverurl and the event settings | varies | Rarely needed. |
A Laravel worker, line by line
This is the worker from Laravel’s queue docs, with full paths:
[program:acme-queue]
command=/usr/bin/php /srv/acme/artisan queue:work --sleep=3 --tries=3 --max-time=3600
directory=/srv/acme
user=forge
process_name=%(program_name)s_%(process_num)02d
numprocs=8
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
stopwaitsecs=3600
redirect_stderr=true
stdout_logfile=/srv/acme/storage/logs/worker.log| Line | What it does |
|---|---|
command= | Runs the worker. --max-time=3600 makes each worker exit after an hour, so it starts fresh. |
directory= | Runs it from the app’s folder. |
user=forge | Runs it as the user that owns the app. Needs supervisord to run as root. |
process_name= and numprocs=8 | Starts eight workers, named acme-queue_00 to acme-queue_07. |
autostart=true | Starts them when supervisord starts. |
autorestart=true | Starts a worker again whenever it exits, including the clean exits Laravel makes on purpose. |
stopasgroup=true and killasgroup=true | Sends the stop signal to anything a worker started, too. |
stopwaitsecs=3600 | Gives a running job up to an hour to finish when the worker is stopped. |
redirect_stderr=true and stdout_logfile= | Writes output and errors to one file. |
Writing a program file
A program file is an INI file: a [program:name] line, then one setting=value per line. The name is what you type in supervisorctl start name, and it can’t contain a colon or brackets.
Where the file goes
supervisord loads the files in the folder named by files= under [include] in its main config. Most setups keep one program per file:
| Installed with | Folder | File ends in |
|---|---|---|
| Ubuntu or Debian package | /etc/supervisor/conf.d/ | .conf |
| Homebrew (macOS) | $(brew --prefix)/etc/supervisor.d/ | .ini |
| Fedora package, or anything else | The files= line under [include] | |
How to write values
| Kind | Write it as | Example |
|---|---|---|
| True or false | true or false; yes, no, on, off, 1 and 0 work too | autostart=false |
| Seconds and counts | A whole number | stopwaitsecs=3600 |
| Sizes | A number with KB, MB or GB | stdout_logfile_maxbytes=10MB |
| Lists | Values separated by commas | exitcodes=0,2 |
| Signals | A name or a number | stopsignal=QUIT |
| Environment | KEY="value" pairs separated by commas | environment=APP_ENV="production" |
Expressions
Some parts of a value are filled in when supervisord loads the file:
%(program_name)s: the name afterprogram:.%(process_num)02d: the copy’s number as two digits,00,01and so on.%(process_num)dgives0,1.%(group_name)s: the name of the program’s group.%(host_node_name)s: the machine’s host name.%(here)s: the folder of supervisord’s main config file.%(ENV_HOME)s:HOMEfrom supervisord’s own environment. Any variable works, as%(ENV_and its name.
Because % starts an expression, write a real % as %%, for example in a password: environment=DB_PASSWORD="pass%%word". A single % usually stops supervisord loading the config, with Format string … is badly formatted. Worse, a few, such as %s, load without an error and are replaced with other text.
Mistakes supervisord won’t warn you about
These load without a clear error, then don’t do what you meant:
| You write | What happens, and what to do |
|---|---|
stopwaitsec=3600 | The typo is ignored, so stopwaitsecs stays 10 and long jobs get killed. When a setting seems to do nothing, check its spelling. |
command=sh -c 'php artisan migrate ; php artisan serve' | Everything from a space and ; on is a comment, even inside quotes, so supervisord runs sh -c 'php artisan migrate. A space and # do the same. Put the commands in a script. |
command=~/bin/worker > $HOME/worker.log | There’s no shell, so ~, $HOME, >, pipes and && aren’t understood. Use full paths, and a script for the rest; see Run it the way supervisord does. |
Loading your changes
Editing a file changes nothing until supervisord loads it:
sudo supervisorctl reread
sudo supervisorctl updatereread shows what changed without doing anything. update applies it:
| You changed | Run | What restarts |
|---|---|---|
| Added a program file | supervisorctl update | Nothing; the new program starts if autostart=true. |
| Any line of a program, even a log setting | supervisorctl update | Every copy of that program. |
| Removed a program file | supervisorctl update | Nothing; the program stops. |
A [group:x] section | supervisorctl update | Every program in the group. |
The [supervisord], [unix_http_server] or [inet_http_server] section | sudo systemctl restart supervisor, or brew services restart supervisor | Every program. |
supervisorctl waits for each program it restarts to stop, so with stopwaitsecs=3600, update can take as long as your longest job.
What to run
Where the program runs, as whom, and with what environment.
command
Default: none; required.
The program and its arguments. A name without a path is looked up on supervisord’s PATH, which is often shorter than your terminal’s: under brew services or systemd it has no Homebrew, nvm or pyenv folders. Use the full path, such as /usr/bin/php or /opt/homebrew/bin/php. Double quotes keep an argument with spaces together.
The program has to stay in the foreground. One that starts a copy of itself in the background and exits looks like a crash; see Programs that go to the background.
With several copies, %(process_num)02d gives each its own value, such as its own port: --port=80%(process_num)02d makes 8000, 8001 and so on.
In Laravel
The command is usually artisan queue:work, artisan horizon, artisan reverb:start or artisan octane:start, after the full path to PHP.
directory
Default: supervisord’s own working folder.
The folder the command starts in. ~ isn’t expanded here either. If the folder doesn’t exist, the program doesn’t start, and the error says couldn't chdir to and the path.
In Laravel
Set it to the app’s root, so a relative artisan works and the app finds its .env.
user
Default: the user supervisord runs as.
Runs the program as another user. Only a supervisord running as root can switch users, as the Ubuntu, Debian and Fedora packages do. Naming the user supervisord already runs as is fine. Any other user, under a supervisord that isn’t root, stops the program from starting with Can't drop privilege as nonroot user. Homebrew’s supervisord runs as you, so leave user= out on a Mac.
user= changes the user only. HOME and USER keep supervisord’s values, which under systemd means root’s. Set them with environment= when the program needs them, as Composer, git and npm do.
In Laravel
Run workers as the user that owns the app, such as forge, deploy or www-data. A worker running as root creates files in storage/, such as each day’s log file, that the web server can’t write to, and the site starts failing with Permission denied on laravel.log.
environment
Default: nothing added; the program inherits supervisord’s environment.
Extra environment variables, as KEY="value" pairs separated by commas. Quote each value, since a comma or colon in an unquoted value breaks the list, and write % as %%. They’re added on top of environment= in the [supervisord] section, which applies to every program.
environment=HOME="/home/forge",APP_ENV="production"In Laravel
A variable set here wins over the same one in .env, because Laravel doesn’t overwrite variables that are already set. After php artisan config:cache, config values come from the cache instead, so a change here doesn’t reach them until you cache the config again.
umask
Default: supervisord’s, usually 022.
The permissions of files the program creates, as an octal number. With 022, only their owner can write to them; with 002, their group can too.
In Laravel
If the worker and the web server run as different users in the same group, umask=002 lets each write to the log and cache files the other created.
How many copies
One section can run several identical copies of a program.
numprocs
Default: 1.
Starts that many copies of the command, each watched and restarted on its own. With more than one, process_name has to contain %(process_num), or supervisord refuses the file with %(process_num) must be present within process_name when numprocs > 1.
The copies are named program:program_00, program:program_01 and so on, and program:* means all of them:
sudo supervisorctl restart acme-queue:*What changes when you raise it:
- Each copy is a whole process. Memory use is roughly one copy’s times
numprocs; check one inpsortopbefore you pick a number. - More copies take more jobs at once, and each holds its own database and Redis connections.
- Changing the number restarts every copy, not only the new ones.
In Laravel
numprocs is how many queue:work processes run, so it’s your queue’s concurrency. Keep it at 1 for:
- Horizon, which starts its own workers from
config/horizon.php; a second copy would start a second set. - The scheduler, which would run each task once per copy.
- Reverb and Octane, which listen on one port; a second copy can’t open it and fails.
process_name
Default: %(program_name)s.
The name of each copy. With numprocs above 1, use %(program_name)s_%(process_num)02d, which gives _00, _01 and so on.
Starting
When a program starts, and when supervisord gives up on it:
start ──▶ STARTING ──(stays up for startsecs)──▶ RUNNING
│
└──(exits sooner)──▶ BACKOFF ──(waits 1 s, 2 s, 3 s…)──▶ STARTING
│
└──(after startretries + 1 tries)──▶ FATALautostart
Default: true.
Starts the program when supervisord starts, and when update loads it. With false, it’s loaded but stays stopped until you supervisorctl start it, which suits tools you run now and then.
startsecs
Default: 1.
How long, in seconds, a program has to stay up to count as started. If it exits sooner, the start failed, even with exit code 0. supervisorctl start waits this long before it reports the start.
- Raise it for a program that can fail a few seconds in, for example while it connects to a database; Celery’s example uses 10. It then ends in FATAL instead of being restarted forever.
- Set it to 0 for a program that can finish quickly on purpose.
startretries
Default: 3.
How many failed starts in a row supervisord allows before it marks the program FATAL. That’s startretries plus one tries, with a wait that grows by a second each time. A FATAL program stays stopped until you start it, even with autorestart=true.
Raise it when the program depends on something that comes up slowly after a reboot, such as Redis or a database on another machine. With startretries=10, supervisord keeps trying for about a minute. FATAL Exited too quickly covers what to do when the tries run out.
priority
Default: 999.
The order programs start and stop in. Lower numbers start first and stop last, when supervisord starts or stops and for start all and stop all. If supervisord runs Redis, give it a lower number than your workers, such as priority=100.
supervisord only sets the order; when it starts, it doesn’t wait for one program to be ready before the next. startretries still has to cover a slow start.
Restarting
What supervisord does when a program that was running exits by itself. It doesn’t apply to a program you stopped, or to failed starts, which Starting covers.
autorestart
Default: unexpected.
| Value | Exits with a code in exitcodes | Exits with any other code |
|---|---|---|
false | Stays stopped | Stays stopped |
unexpected | Stays stopped | Starts again |
true | Starts again | Starts again |
A program that stays stopped shows as EXITED.
In Laravel
Workers exit with code 0 on purpose: after --max-time, after --max-jobs, and after php artisan queue:restart. With the default unexpected, supervisord counts that as expected and leaves the worker stopped, so the first deploy that runs queue:restart stops every worker for good. Set autorestart=true, as Laravel’s example does. The same goes for Horizon after horizon:terminate.
A worker that passes its --memory limit, 128 MB by default, exits with code 12.
exitcodes
Default: 0.
The exit codes that count as expected, as a list such as 0,2. They matter only with autorestart=unexpected. Before supervisord 4.0 the default was 0,2. A one-off job that should run again only when it fails:
startsecs=0
autorestart=unexpected
exitcodes=0Stopping
On stop, restart and update, and when supervisord itself stops, as on a reboot, supervisord:
- sends the program
stopsignal; - waits up to
stopwaitsecsfor it to exit; - kills it with SIGKILL if it’s still running.
stopsignal
Default: TERM.
The signal that asks the program to stop: TERM, HUP, INT, QUIT, KILL, USR1 or USR2, by name or number. Use the one your program treats as a graceful stop:
| Program | Graceful stop |
|---|---|
Laravel queue:work and Horizon | TERM, the default |
| Celery | TERM, the default |
| Gunicorn | TERM, the default; QUIT stops at once |
| nginx | QUIT; TERM stops at once |
| PHP-FPM | QUIT; TERM stops at once |
In Laravel
Leave it at TERM. A worker that gets TERM, INT or QUIT finishes its current job, then exits. That needs PHP’s pcntl extension; without it, the signal ends the worker in the middle of the job.
stopwaitsecs
Default: 10.
How long supervisord waits after the stop signal before it kills the program with SIGKILL, which the program can’t catch.
A higher value costs time: stop, restart, update and a deploy that restarts the program can each wait that long.
In Laravel
Set it above your longest job, as Laravel’s docs say; their example uses 3600. A job killed halfway goes back on the queue after retry_after seconds and runs again from the start. Keep the worker’s --timeout a few seconds below retry_after in config/queue.php, so a stuck job is stopped before another worker picks it up.
stopasgroup and killasgroup
Default: false; killasgroup follows stopasgroup.
stopasgroup=truesends the stop signal to the program and every process it started.killasgroup=truedoes the same for the final SIGKILL only.
stopasgroup=true with killasgroup=false isn’t allowed, and supervisord refuses the file.
Turn them on when the program starts other processes and doesn’t pass the signal on: a shell script that doesn’t exec its command, npm run, a Flask or Django dev server with its reloader, or Python with multiprocessing. Without them, those processes keep running after a stop, still holding their port or taking jobs. A process that moves itself into a new process group, as daemons do, escapes them anyway.
In Laravel
The worker example turns both on. The Horizon example leaves them off, because Horizon stops its own workers.
Logs
Where a program’s output goes, and how big it gets.
redirect_stderr
Default: false.
With true, the program’s errors go to the same file as its output, like 2>&1. One file is easier to read, but you can no longer tell errors from output. Leave it off in an [eventlistener:x] section.
stdout_logfile and stderr_logfile
Default: AUTO.
Where the program’s output and errors are written:
| Value | What happens |
|---|---|
| A path | Written to that file. Its folder has to exist, or the program won’t start. Expressions work, as in worker_%(process_num)02d.log. |
AUTO | A file in supervisord’s childlogdir, usually the system’s temp folder, with a name like acme-queue-stdout---supervisor-k2x9a1.log. Deleted when supervisord restarts. |
NONE | No file. The output is thrown away, and supervisorctl tail has nothing to show. |
/dev/stdout | The usual choice in Docker. Also set stdout_logfile_maxbytes=0, since it can’t be rotated. |
Two processes mustn’t share one file while rotation is on; supervisord’s docs say the file gets corrupted when it rotates. Give each copy its own file with %(process_num)02d, or set stdout_logfile_maxbytes=0 and rotate the file with logrotate.
In Laravel
Laravel’s example has all eight workers write to one worker.log with rotation on, which is the case above; use one of the two fixes. The file holds what the worker prints, a line for each job as it runs and finishes, and PHP fatal errors. A job’s exceptions go to storage/logs/laravel.log.
Log size and backups
Default: stdout_logfile_maxbytes=50MB and stdout_logfile_backups=10, and the same for stderr_.
When a log reaches maxbytes, supervisord renames it to .1, keeps up to backups old files and starts a new one. maxbytes=0 turns rotation off, and the file grows until something else rotates it. backups=0 keeps no old files.
The limits are per file, and each copy has its own files. Eight workers with separate output and error files can use up to 8 × 2 × 11 × 50 MB, about 8.8 GB. For a chatty program:
stdout_logfile_maxbytes=10MB
stdout_logfile_backups=3stdout_syslog and stderr_syslog
Default: false. Since supervisord 4.0.
With true, the output also goes to syslog, tagged with the program’s name. Use it when your server already collects syslog or journald.
Rarely needed
| Setting | Default | What it’s for |
|---|---|---|
numprocs_start | 0 | The number copies count from. With numprocs_start=1 they’re _01 to _08, and --port=80%(process_num)02d starts at 8001. |
stdout_capture_maxbytes, stderr_capture_maxbytes | 0, off | Capture mode: text the program prints between supervisord’s special tags is sent to event listeners as a PROCESS_COMMUNICATION event. |
stdout_events_enabled, stderr_events_enabled | false | Sends each piece of output to event listeners as a PROCESS_LOG event. |
serverurl | AUTO | The address of supervisord passed to the program as SUPERVISOR_SERVER_URL, for programs that talk to supervisord themselves. |
Every program also gets SUPERVISOR_ENABLED=1, SUPERVISOR_PROCESS_NAME and SUPERVISOR_GROUP_NAME in its environment, which a script can check to know it runs under supervisord.
Groups
A [group:x] section puts programs together, so one command starts, stops or restarts them all:
[group:acme]
programs=acme-queue,acme-horizon,acme-scheduler
priority=999programs=is required: the program names, separated by commas.priority=orders the group as a whole, like a program’s; 999 by default.
Grouped programs are renamed: the workers become acme:acme-queue_00 and so on, and acme:* means everything in the group. The old names, such as acme-queue:*, stop working, so update any deploy script that uses them.
Event listeners and FastCGI
Two other kinds of section take every program setting, plus a few of their own.
Event listeners
An [eventlistener:x] section runs a program that receives supervisord’s events, such as a process changing state, on its standard input. It takes every program setting except stdout_capture_maxbytes, plus:
| Setting | Default | What it does |
|---|---|---|
events | none, required | The events it wants, such as PROCESS_STATE, PROCESS_STATE_FATAL or TICK_60 (once a minute). |
buffer_size | 10 | How many events can wait for the listener. When it’s full, the oldest is dropped. |
result_handler | supervisord’s own | Almost never changed. |
Most people use the listeners in the superlance package rather than writing one. memmon restarts a program that uses too much memory:
[eventlistener:memmon]
command=memmon -g acme=256MB
events=TICK_60Laravel workers already do this with --memory, so memmon matters more for other programs.
FastCGI programs
An [fcgi-program:x] section makes supervisord open a socket and hand it to every copy of the program, which reads it from file descriptor 0:
| Setting | Default | What it does |
|---|---|---|
socket | none, required | tcp://localhost:9002 or unix:///path/to/app.sock. |
socket_owner | the program’s user | The owner of a Unix socket, as user or user:group. |
socket_mode | 0700 | The permissions of a Unix socket. |
socket_backlog | the system’s maximum | How many connections can wait. |
PHP-FPM manages its own processes, so a Laravel app doesn’t need this.
supervisord’s own settings
The [supervisord] section configures supervisord itself, and some of its settings reach every program. A change here needs supervisord restarted.
| Setting | Default | Change it when |
|---|---|---|
logfile | supervisord.log in the folder it starts from | You want supervisord’s own log somewhere else. supervisorctl maintail shows it. |
logfile_maxbytes, logfile_backups | 50MB, 10 | As for program logs. |
loglevel | info | A program won’t start: debug also writes programs’ output into supervisord’s log. |
pidfile | supervisord.pid in the folder it starts from | Your service manager expects it elsewhere. |
nodaemon | false | Docker, or anything that needs supervisord in the foreground: set true. |
silent | false | In the foreground, you don’t want its log on the terminal. |
minfds | 1024 | Programs keep many files or connections open. Every program inherits the limit; Laravel’s Reverb docs suggest minfds=10000. |
minprocs | 200 | Programs start many processes. |
umask | 022 | supervisord’s own files need other permissions. |
user | no switch | supervisord starts as root but should run as another user. |
directory | no change | supervisord should move to a folder when it goes to the background. |
childlogdir | the system’s temp folder | You use AUTO program logs and want them kept somewhere else. |
nocleanup | false | You want AUTO logs kept when supervisord restarts. |
environment | nothing | Every program needs the same variables. |
strip_ansi | false | Programs print colour codes into their logs. |
identifier | supervisor | Tools tell several supervisords apart by it. |
The other sections connect supervisorctl to supervisord:
| Section | Settings | What it’s for |
|---|---|---|
[unix_http_server] | file, chmod (0700), chown, username, password | The socket. Who can open it decides who can run supervisorctl; see Permission denied on the socket. |
[inet_http_server] | port, username, password | A TCP port instead of, or beside, the socket. Keep it on 127.0.0.1. |
[supervisorctl] | serverurl, username, password | Where supervisorctl connects. serverurl has to match the socket or port; see supervisor.sock: no such file. |
[rpcinterface:supervisor] | leave as the sample has it | supervisorctl needs it. |
[include] | files | The program files to load: patterns separated by spaces, relative to the main config. Included files can’t include others. |
Quick picks for Laravel
| Process | Settings that matter |
|---|---|
queue:work | numprocs for concurrency, autorestart=true, stopwaitsecs above your longest job, stopasgroup and killasgroup, and --max-time in the command. |
| Horizon | numprocs=1, autorestart=true, stopwaitsecs above your longest job, as in Horizon’s docs. Restart it with php artisan horizon:terminate. |
| Scheduler | schedule:work with numprocs=1. On a server, Laravel’s docs run schedule:run from cron instead. |
| Reverb | numprocs=1, and minfds raised in [supervisord]. Restart it with php artisan reverb:restart. |
| Octane | numprocs=1; Laravel’s docs use stopwaitsecs=3600. |
Whole configs: Laravel Horizon on a Mac for Horizon, workers and the scheduler, and Celery under supervisord for Python.
With Visor
Visor knows every program setting in this guide. In a config’s Config tab, and in Add new, the explanation beside the editor says what each line does, and the checks run as you type. They catch the silent mistakes: a misspelt setting gets unknown key stopwaitsec. Did you mean stopwaitsecs? with a fix that renames it, numprocs above 1 without %(process_num) in process_name is an error, and so is a log folder that doesn’t exist. Saving shows the diff, and Save & apply writes the file and loads it, like supervisorctl update. See Program configs.
The text is under CC BY 4.0: reuse it with credit to Touhidur Rahman and a link to this page. The code examples are free to copy.