Mastering Supervisorctl: Your Command-Line Guide to Process Management
Supervisor must be installed and configured on your Linux system. You should have at least one program configured within your Supervisor configuration files (typically found in /etc/supervisor/conf.d/ or /etc/supervisor/supervisord.conf).
help : Inside the supervisor> prompt, typing help displays a list of available supervisorctl commands.help <command> : To get specific help on a particular supervisorctl command, type help followed by the command name.
reread : This supervisorctl command instructs the Supervisor daemon to reread its configuration files. Execute this after making any changes to your Supervisor configuration files.After running reread via supervisorctl, the new program definitions are recognized by Supervisor, but no changes are automatically applied to running processes.
update : The supervisorctl update command compares the current running processes with the newly reread configuration. It performs the following actions:Starts any new programs defined in the configuration that are not currently running. Restarts programs whose configuration has been updated (if autorestart is set to true in their configuration). Removes processes that have been removed from the configuration.
Always run supervisorctl update after supervisorctl reread to ensure your running processes align with the latest configuration.
status : Executing status within supervisorctl shows the current status of all processes managed by Supervisor.The output from supervisorctl status includes the process name, its current state, process ID (PID), and uptime. status <name> : To view the status of specific processes or process groups using supervisorctl, provide their names (comma-separated).Wildcards can also be used with supervisorctl status to check the status of multiple processes within a group (e.g., mywebapp:*).
start <name> : Use the supervisorctl start command to initiate one or more processes that are currently in a stopped state.start all : To start all processes managed by Supervisor that are not currently running, use supervisorctl start all.
stop <name> : The supervisorctl stop command allows you to gracefully halt one or more running processes.stop all : To stop all currently running processes managed by Supervisor, execute supervisorctl stop all.
restart <name> : The supervisorctl restart command provides a convenient way to stop and then immediately start one or more processes. This is useful for applying configuration changes that require a process restart.restart all : To restart all processes managed by Supervisor, use supervisorctl restart all.
signal <signal> <name> : With supervisorctl signal, you can send specific signals to managed processes. Use signal names (e.g., SIGTERM, SIGKILL, SIGHUP) or their numerical values.signal SIGTERM <name> : Sends a termination signal, allowing the process to shut down cleanly.signal SIGKILL <name> : Forcefully terminates the process (use as a last resort).signal SIGHUP <name> : Often instructs the application to reload its configuration.
signal <signal> all : To send a specific signal to all managed processes, use supervisorctl signal <signal> all.
clear <name> : The supervisorctl clear command resets the error state of a process that might have exited too quickly. This allows Supervisor to attempt restarting the process again (if autorestart is enabled).clear all : To clear the error states of all managed processes, use supervisorctl clear all.
getlog <name> : The supervisorctl getlog command retrieves the most recent 100 bytes of combined stdout and stderr output for the specified process.maintail <name> : Use supervisorctl maintail to continuously display the tail of the stdout and stderr output for a process in real-time. Press Ctrl+C to stop following the logs.
shutdown : The supervisorctl shutdown command stops all managed processes and then shuts down the Supervisor daemon itself.After using supervisorctl shutdown, you will need to manually restart the supervisord service to resume process management.
exit orquit : To leave the supervisorctl interactive prompt and return to your shell, type exit or quit.
Applying configuration changes: Restarting a specific web application: Troubleshooting a failed worker process:
Comments
Post a Comment