Introduction
Supervisor is a process control system for Unix that lets you manage and monitor long-running processes. It automatically starts processes at boot, restarts them on crash, and provides a CLI and web interface for managing process groups. It is widely used to run application servers, workers, and background tasks in production.
What Supervisord Does
- Starts, stops, and restarts managed processes with automatic crash recovery
- Groups related processes for batch control (start/stop a service stack at once)
- Provides a CLI tool (
supervisorctl) for interactive process management - Exposes a web UI and XML-RPC API for remote monitoring
- Logs stdout and stderr from managed processes to rotated log files
Architecture Overview
Supervisord runs as a daemon (the server process) that reads an INI-style configuration file defining programs and their parameters. Each managed program runs as a child process. The daemon monitors child processes via SIGCHLD signals and restarts them according to the configured policy. The supervisorctl client communicates with the daemon over a Unix socket or TCP using XML-RPC.
Self-Hosting & Configuration
- Install via pip:
pip install supervisor - Generate a config template:
echo_supervisord_conf > /etc/supervisord.conf - Define programs in
[program:name]sections withcommand,directory, anduser - Set
autorestart=truefor automatic crash recovery - Enable the web UI by configuring
[inet_http_server]with a port and credentials
Key Features
- Automatic process restart on crash or exit
- Process groups for managing related services together
- Built-in log rotation for stdout and stderr
- Event listeners for custom notifications on process state changes
- Web dashboard for real-time status monitoring
Comparison with Similar Tools
- systemd — Linux-native init system; Supervisord is cross-platform and simpler to configure
- PM2 — Node.js-focused process manager with clustering; Supervisord is language-agnostic
- Docker — Container-level process management; Supervisord manages processes within a single host or container
- runit — Minimal init scheme; Supervisord offers richer monitoring and a web UI
FAQ
Q: Can Supervisord manage Docker containers? A: Supervisord manages Unix processes, not containers. It is often used inside Docker containers to run multiple processes in a single container when needed.
Q: How does Supervisord handle process dependencies?
A: Use priority values to control start order and process_groups to manage related services. For strict dependency ordering, use event listeners or startup scripts.
Q: Does Supervisord work on macOS? A: Yes. Supervisord runs on any Unix-like system including macOS and Linux. It does not support Windows natively.
Q: Can I extend Supervisord with plugins?
A: Yes. Supervisord supports event listeners that react to process state changes, and third-party plugins like superlance add advanced monitoring features.