What is Supervisor?
19 November 2023 (Updated 2 October 2024)
In a nutshell
- A process control system for Unix.
- Shares some goals of tools like
launchd
but the main difference is that it’s not meant to be run as a substitute forinit
as “process id 1”. Instead, it’s intended to start like any other program at boot time but is used to control processes related to a project. - Starts processes as child processes of the main process.
- It lets you group processes as a single unit.
- It lets you control the order in which processes start.
- Programs (e.g., Nginx or PHP-FPM) running under supervisor should be run in the foreground and not be daemonized.
Components
supervisord
Server component responsible for starting child programs, responding to commands from clients, restarting exited/crashed subprocesses, etc.
Managed via a INI config file, usually at /etc/supervisord.conf
.
supervisorctl
Client program that can communicate with supervisord to start or stop subprocesses. Talks to supervisor d via Unix domain socket or TCP socket.
Web server
A minimal web UI that provides functionality similar to supervisorctl. Available if you start supervisord via a TCP socket.
XML-RPC interface
You can use this interface to view the status of supervisor and manage its processes.
Installation
Install package
apt-get supervisor
Create initial config:
echo_supervisord_conf > /etc/supervisord.conf
Basic usage
Start supervisord in the background
supervisord
See options for more control.
Start supervisorctl in interactive mode
supervisorctl
See list of actions available.
Get the status of processes
supervisorctl status all
Stop supervisor
Get PID:
supervisorctl pid
Kill that process:
kill <pid>
Sources
Tagged:
Unix
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment