LinuxCommandLibrary

supervisord

Manage and monitor processes

TLDR

Start supervisord with specified configuration file

$ supervisord [[-c|--configuration]] [path/to/file]
copy

Run supervisord in the foreground
$ supervisord [[-n|--nodaemon]]
copy

SYNOPSIS

supervisord [options]

PARAMETERS

-c CONFIG_FILE | --configuration=CONFIG_FILE
    Specifies the path to the configuration file. Default is usually /etc/supervisord.conf or supervisord.conf in the current directory.

-n | --nodaemon
    Runs supervisord in the foreground instead of daemonizing. Useful for debugging or when running under a process manager like systemd.

-d | --debug
    Enables debug logging, providing more verbose output to the console or log file.

-h | --help
    Displays a help message and exits.

-v | --version
    Prints the version number of supervisord and exits.

--minfds=NUM
    Sets the minimum number of file descriptors that supervisord requires to run.

--minprocs=NUM
    Sets the minimum number of processes that supervisord requires to run.

--username=USER
    Specifies the user to run supervisord as after startup. Requires root privileges to start.

--identifier=ID
    Sets a unique identifier for the supervisord instance, useful when running multiple instances.

--noreload
    Prevents supervisord from reloading its configuration upon receiving a SIGHUP signal.

--pidfile=FILE
    Specifies the path to the PID file where supervisord will write its process ID.

--logfile=FILE
    Specifies the path to the log file for supervisord's own logging.

--loglevel=LEVEL
    Sets the logging level for supervisord (e.g., CRITICAL, ERROR, WARN, INFO, DEBUG, BLATHER).

--strip-section-headers
    Used internally, removes section headers from configuration output.

DESCRIPTION

supervisord is the daemon component of the Supervisor process control system. It allows users to monitor and control a number of processes on UNIX-like operating systems. Its primary purpose is to keep long-running programs running reliably by automatically restarting them if they crash or exit unexpectedly. supervisord manages processes as "programs" defined in its configuration file, typically supervisord.conf.

Key features include the ability to group processes, handle process events, and provide a command-line client (supervisorctl) and an HTTP web interface for interaction. It also exposes an XML-RPC interface for programmatic control. supervisord runs as a single process and forks child processes for each configured program, managing their lifecycle and ensuring they remain in the desired state. It's widely used in web development and backend services to ensure application stability and uptime without manual intervention. It excels at managing non-daemonizing processes, allowing them to run reliably in the background.

CAVEATS

While supervisord is excellent for managing application processes, it is generally not intended to be the primary init system or a replacement for systemd, Upstart, or traditional init scripts. It should be started by one of these system-level tools at boot. It is also primarily designed for controlling non-daemonizing programs; programs that daemonize themselves (fork() and exit()) can be managed but require specific configuration (e.g., redirect_stderr=true, stdout_logfile=) to prevent supervisord from losing track of them.

CONFIGURATION FILE (<I>SUPERVISORD.CONF</I>)

The core of supervisord's operation lies in its configuration file. This INI-like file defines the programs to be managed, their startup commands, working directories, environment variables, auto-restart behavior, logging settings, and more. It also specifies supervisord's own settings, such as PID file location, log file, and [inet_http_server] details for the web UI.

INTERACTION WITH <I>SUPERVISORCTL</I>

supervisorctl is the essential command-line client used to interact with a running supervisord instance. It allows users to start, stop, restart, and get the status of individual programs or entire groups of programs. It also supports commands for reloading the configuration, shutting down supervisord, and displaying logs, providing full control over the managed processes without directly interacting with the daemon.

HISTORY

Supervisor, including supervisord, was originally developed by Chris McDonough and is written in Python. It emerged as a solution for reliably running and monitoring long-lived processes, especially in the context of web application servers (like Gunicorn, uWSGI) and worker processes (like Celery). Its development aimed to provide a simpler, more robust alternative to complex shell scripts or relying solely on init systems for application-level process management. Its popularity grew due to its ease of configuration, cross-platform compatibility (within UNIX-like systems), and the flexibility offered by its client and API interfaces. It has become a de facto standard for process management in many Python, Node.js, and PHP environments.

SEE ALSO

supervisorctl(1), systemctl(1), ps(1), kill(1), cron(8)

Copied to clipboard