LinuxCommandLibrary

supervisorctl

Control and monitor supervisor managed processes

TLDR

Show the status of a process (or all processes if process_name is not specified)

$ supervisorctl status [process_name]
copy

Start/stop/restart a process
$ supervisorctl [start|stop|restart] [process_name]
copy

Start/stop/restart all processes in a group
$ supervisorctl [start|stop|restart] [group_name]:*
copy

Show last 100 bytes of process stderr
$ supervisorctl tail -100 [process_name] stderr
copy

Keep displaying stdout of a process
$ supervisorctl tail -f [process_name] stdout
copy

Reload process configuration file to add/remove processes as necessary
$ supervisorctl update
copy

SYNOPSIS

supervisorctl [options] <action> [action_arguments]
Common Actions:
status [program_name]
start <program_name>|<group_name>:*|all
stop <program_name>|<group_name>:*|all
restart <program_name>|<group_name>:*|all
tail <program_name> [stdout|stderr] [bytes]
reload
update
shutdown

PARAMETERS

status [program_name]
    Shows the status of all managed processes, or a specific process if program_name is provided.

start <name>
    Starts a process or group of processes. <name> can be a program name, group_name:*, or the keyword all.

stop <name>
    Stops a process or group of processes.

restart <name>
    Restarts a process or group of processes. This is equivalent to issuing a stop followed by a start.

tail <name> [stdout|stderr] [bytes]
    Displays the last part of a process's log output. Defaults to stdout. Optionally specify stderr or a number of bytes.

reload
    Reloads supervisord configuration without restarting the daemon. This makes changes effective for new programs.

update
    Reloads supervisord configuration and applies changes, starting or stopping processes as required to match the new configuration.

shutdown
    Gracefully shuts down the supervisord daemon and all its managed processes.

-c <config_file>
    Specifies an alternate configuration file for supervisord to connect to.

-h
    Displays a help message and exits.

DESCRIPTION

supervisorctl is a command-line client for the Supervisor process control system. It allows users to interact with the supervisord daemon, which manages a group of processes. With supervisorctl, you can effectively monitor the status of running programs, start or stop individual processes or groups of processes, restart them, and view their log output. It provides a convenient interface to manage the lifecycle of applications, ensuring they run continuously and are automatically restarted if they crash. It connects to the supervisord server, typically via a Unix domain socket or a TCP port, to issue commands and retrieve information. This tool is essential for managing persistent services and applications, especially in server environments where reliable process uptime is critical.

CAVEATS

supervisorctl requires the supervisord daemon to be running for it to function. Users must have appropriate permissions to connect to the supervisord socket or TCP port. Configuration changes made to supervisord.conf typically require a reload or update command for them to take effect on managed processes.

INTERACTIVE MODE

When invoked without any arguments, supervisorctl enters an interactive shell. This allows users to issue multiple commands consecutively without retyping supervisorctl each time, facilitating efficient management of processes.

CONFIGURATION

supervisorctl communicates with supervisord based on the configuration defined in supervisord.conf (or an alternative file specified with -c). This file dictates the processes to be managed, their restart policies, log locations, and more.

HISTORY

Supervisor, including the supervisorctl client, was created by Chris McDonough and has been actively developed since the early 2000s. It was designed to provide a lightweight and robust process control system, particularly gaining popularity for managing long-running services and applications in environments where full-fledged init systems like systemd might be considered too heavy or are not available.

SEE ALSO

supervisord(1), systemctl(1), init(8), ps(1)

Copied to clipboard