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 [-c file] [-n] [-u user] [-d]

PARAMETERS

-c file
    Specify an alternate configuration file. Defaults to supervisord.conf in the current directory and then to /etc/supervisord.conf

-n
    Run in non-daemon mode (foreground).

-u user
    Change user after startup (requires root privileges to run as the initial user).

-d
    Daemonize after startup.

DESCRIPTION

supervisord is a client/server system that allows users to monitor and control a number of processes on Linux-like operating systems. It is particularly useful for ensuring that critical services remain running, automatically restarting them if they crash or are unexpectedly terminated.

supervisord is designed to be very reliable and provide a consistent interface for managing processes, whether they are simple scripts or complex applications. It's configured via a configuration file, typically named `supervisord.conf`, which defines the processes to be managed, their startup commands, dependencies, logging options, and other relevant parameters. Through the `supervisorctl` command-line client, you can interact with the supervisord server to start, stop, restart, and query the status of managed processes. It provides a centralized process management solution, simplifying the administration of long-running applications and services.

CAVEATS

supervisord requires root privileges to perform certain actions, such as changing the user with the `-u` option. Incorrect configuration can lead to processes being repeatedly started and stopped, potentially overloading the system. It requires an active configuration file to work correctly. Without a configuration file, it will error out. It does not directly manage systemd services. You can run supervisord as a systemd service, but it manages independent processes specified in its configuration file.

CONFIGURATION FILE

The supervisord configuration file is a key component. It defines the processes to be managed, their startup commands, environment variables, and other settings. The configuration file is typically in INI format and allows you to define multiple programs under the `[program:name]` section. It dictates how supervisord interacts with the processes it manages.

SIGNAL HANDLING

supervisord can send signals to managed processes, allowing you to gracefully shut down or restart applications. The configuration file allows you to specify the signal to use when stopping a process. Signals such as SIGTERM (for graceful shutdown) or SIGKILL (for immediate termination) are commonly used.

HISTORY

supervisord was created by Chris McDonough. It was designed to be a more robust and feature-rich alternative to simple init scripts and shell-based process managers. It has seen widespread adoption in web application deployments and other environments where reliable process management is crucial. It has evolved significantly over time, with improvements in stability, features, and configuration options. Its consistent interface and robust process monitoring have made it a popular choice for managing critical services.

SEE ALSO

supervisorctl(1), kill(1), ps(1)

Copied to clipboard