Home

Linux Supervisord

Linux Supervisord (supervisord.conf) Program Generator

Zero-Zombie POSIX

Generate Supervisord program configuration blocks with auto-restart, process counts, log redirection, environment variables, and user privileges.

Presets:
Program Binary & Execution
Process Cluster & Concurrency
Instances: 4
Lifecycle & Auto-Restart Policies
POSIX Signals & Process Tree Containment
Logging & Stream Redirection
Environment Variables
KEY="value"

Line breaks will automatically be formatted into standard comma-separated Supervisord syntax.

; ==============================================================================
; Supervisord Program Configuration: laravel-worker
; Generated 100% Client-Side Private on ToolsAA
; Path: /etc/supervisor/conf.d/laravel-worker.conf (Ubuntu/Debian)
;   or: /etc/supervisord.d/laravel-worker.ini (CentOS/RHEL/Rocky)
; ==============================================================================

[program:laravel-worker]
command=php /var/www/laravel/artisan queue:work redis --sleep=3 --tries=3 --max-time=3600
process_name=%(program_name)s_%(process_num)02d
numprocs=4
directory=/var/www/laravel
user=www-data
umask=022
priority=999
autostart=true
autorestart=true
startsecs=1
startretries=3
stopsignal=QUIT
stopwaitsecs=3600
stopasgroup=true
killasgroup=true
redirect_stderr=true
stdout_logfile=/var/log/supervisor/laravel-worker.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=5
environment=APP_ENV="production",CACHE_DRIVER="redis"
Cluster Concurrency
4 Processes

Load-balanced parallel execution pool

Zombie Protection
100% Contained

stopasgroup & killasgroup both active

Log Rotation Limit
50MB × 5

Capped disk consumption with automatic log rotation

100% In-Browser Deterministic INI Synthesis

Zero server uploads or background tracking. Process configurations, environment keys, and security masks are parsed and generated completely in your browser memory.

Safe Process Tree Containment & Zombie Prevention

Pre-configured with stopasgroup and killasgroup flags to ensure subprocesses (e.g., Celery, Gunicorn, Node child processes) are terminated cleanly without leaving orphaned zombies.

Multi-Platform Production Compatibility

Tailored for Ubuntu/Debian /etc/supervisor/conf.d/, RHEL/CentOS /etc/supervisord.d/, Docker container multi-process entrypoints, and systemd units.

Technical Reference & Architecture Guide

Linux Supervisord (supervisord.conf) Program Generator — Reference Guide

Generate Supervisord program configuration blocks with auto-restart, process counts, log redirection, environment variables, and user privileges.

Key Parameters & Controls

commandDirective

The full command line to execute. Must execute in foreground mode without daemonizing or forking.

Default: Required
directoryDirective

Absolute filesystem path to set as the working directory before executing the command.

Default: /var/www/app
autostartDirective

Whether this program automatically launches when the supervisord daemon starts.

Default: true
autorestartDirective

Auto-restart policy upon exit ('true' always, 'false' never, or 'unexpected' for non-zero exit codes).

Default: true
userDirective

Unprivileged UNIX user account to drop privileges to before starting the process.

Default: www-data
numprocsDirective

Number of concurrent worker instances. Requires process_name with %(process_num)s template.

Default: 1
stopasgroupDirective

Broadcasts SIGTERM/SIGINT stop signals to the entire process group to cleanly terminate child workers.

Default: true
stdout_logfileDirective

Destination file path for stdout output. Supports automatic log rotation and retention settings.

Default: /var/log/supervisor/%(program_name)s.out.log

Pro Tips & Best Practices

Always Disable Background Daemonizing

Supervisord tracks process states via PID. Programs must stay in the foreground (e.g. use 'daemon off;' for Nginx, avoid nohup or '&', and omit --daemon flags in Gunicorn).

Pair stopasgroup with killasgroup

For runtimes like Node.js, Celery, or Gunicorn that spawn worker subprocesses, set both 'stopasgroup=true' and 'killasgroup=true' to prevent orphaned zombie processes on shutdown.

Leverage Atomic supervisorctl Reloads

Never run 'supervisorctl reload' in production, as it restarts the main supervisor daemon and all workers. Instead, use 'supervisorctl reread' followed by 'supervisorctl update' to reload only altered programs.

When setting 'numprocs=4'

When setting 'numprocs=4', you must specify 'process_name=%(program_name)s_%(process_num)02d'. This automatically gives each child process unique names and dedicated log streams.

Common Gotchas & Troubleshooting

Process enters FATAL state with 'Exited too quickly' error

This happens if your application forks into the background, crashes immediately, or exits with code 0 before 'startsecs'. Ensure the process runs in the foreground, check stdout/stderr logs, and configure 'startsecs=5' to allow startup time.

SPAWNERR: Can't drop privilege to non-existent or restricted user

Verify that the UNIX user in 'user=' exists in /etc/passwd and has read/execute rights to the application binary and write permissions to the 'directory' and log file directories.

Worker subprocesses remain running after stopping the program

Set 'stopasgroup=true' and 'killasgroup=true' in the [program:name] block. Without these, only the parent supervisor wrapper process receives the termination signal.

Frequently Asked Questions

Where should individual program configuration files be placed on Linux?▼

On Debian/Ubuntu systems, individual program files belong in /etc/supervisor/conf.d/*.conf. On CentOS/RHEL/Rocky Linux, they typically reside in /etc/supervisord.d/*.ini or *.conf, included via the main supervisord.conf [include] directive.

How do I apply configuration changes without restarting all services?▼

Execute 'supervisorctl reread' to detect newly added or edited configuration blocks, then run 'supervisorctl update'. This gracefully applies changes only to updated programs while leaving healthy running processes untouched.

How do I run Python virtual environments (venv) or Node.js version managers in Supervisord?▼

Supervisord does not load user shell profiles (.bashrc or .zshrc). Specify absolute paths directly to the virtualenv binary, for example: command=/home/appuser/venv/bin/gunicorn app:app or command=/home/appuser/.nvm/versions/node/v20.0.0/bin/node server.js.

What is the difference between autorestart=true and autorestart=unexpected?▼

Setting 'autorestart=true' restarts the process unconditionally whenever it terminates, even after a clean zero-status exit. Setting 'autorestart=unexpected' only restarts the process if it exits with an unlisted status code not defined in 'exitcodes' (default: 0 and 2).

How do I set environment variables for a Supervisord program?▼

Use the 'environment=' directive with comma-delimited key-value pairs, like: environment=NODE_ENV="production",PORT="3000",DATABASE_URL="postgres://...". Values containing commas or spaces must be enclosed in double quotes.

Related Tools & Utilities

All Tools →