Show Menu
Cheatography

Running superv­isord

-c FILE
path to superv­isord config­uration file
-n
run superv­isord in the foreground
-u USER
UNIX username or numeric user id
-l FILE
filename path to use as the superv­isord activity log
-e LEVEL
Valid levels are trace, debug, info, warn, error, and critical
-j FILE
filename to which superv­isord should write its pid file

Running superv­isorctl

-c FILE
config­uration file path
-u USER
username to use for authen­tic­ation with server
-p PASSWORD
password to use for authen­tic­ation with server
-r
keep a readline history

Superv­isord Signal

SIGTERM
superv­isord and all its subpro­cesses will shut down
SIGINT
superv­isord and all its subpro­cesses will shut down
SIGQUIT
superv­isord and all its subpro­cesses will shut down
SIGHUP
superv­isord will stop all processes, reload the config­uration from the first config file it finds, and start all processes
SIGUSR2
superv­isord will close and reopen the main activity log and all child log files

Installing superv­isord

Installing With Pip
pip install supervisor
Install On Debian
apt-get install supervisor
Install On Redhat
yum install supervisor
Install On Archlinux
pacman -S supervisor

Using Enviro­nment Variables

[program:example]
command=/usr/bin/example --loglevel=%(ENV_LOGLEVEL)s
Enviro­nment variables that are present in the enviro­nment at the time that superv­isord is started can be used in the config­uration file using the Python string expression syntax %(ENV_X)s

Using UNIX domain socket

[unix_http_server]
file = /tmp/supervisor.sock
chmod = 0777
chown= nobody:nogroup
username = user
password = 123
HTTP server that listens on a UNIX domain socket

Using process group

[group:foo]
programs=bar,baz
priority=999
Group “homog­eneous” process groups (aka “progr­ams”) together into a “heter­oge­neous” process group
 

Using TCP domain socket

[inet_http_server]
port = 127.0.0.1:9001
username = user
password = 123
HTTP server that listens on a TCP (internet) socket

Using superv­isord

[supervisord]
logfile = /tmp/supervisord.log
logfile_maxbytes = 50MB
logfile_backups=10
loglevel = info
pidfile = /tmp/supervisord.pid
nodaemon = false
minfds = 1024
minprocs = 200
umask = 022
user = chrism
identifier = supervisor
directory = /tmp
nocleanup = true
childlogdir = /tmp
strip_ansi = false
environment = KEY1="value1",KEY2="value2"
Global settings related to the superv­isord

Using superv­isorctl

[supervisorctl]
serverurl = unix:///tmp/supervisor.sock
username = chris
password = 123
prompt = mysupervisor
Superv­isorctl intera­ctive shell program

Using program

[program:cat]
command=/bin/cat
process_name=%(program_name)s
numprocs=1
directory=/tmp
umask=022
priority=999
autostart=true
autorestart=unexpected
startsecs=10
startretries=3
exitcodes=0,2
stopsignal=TERM
stopwaitsecs=10
stopasgroup=false
killasgroup=false
user=chrism
redirect_stderr=false
stdout_logfile=/a/path
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
stderr_logfile=/a/path
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
stderr_events_enabled=false
environment=A="1",B="2"
serverurl=AUTO
Superv­isord to know which programs it should start and control

Using config­uration directory

[include]
files = supervisord.d/*.conf
Include config­uration files from drop in directory

Log Level

critical
CRIT
error
ERRO
warn
WARN
info
INFO
debug
DEBG
trace
TRAC
blather
BLAT
 

Superv­isorctl actions

help
print a list of available actions
help <ac­tio­n>
print help for <ac­tio­n>
add <na­me> [...]
activates any updates in config for proces­s/group
remove <na­me> [...]
removes proces­s/group from active config
update
reload config and then add and remove as necessary
clear <na­me>
clear a process’ log files
clear <na­me> <na­me>
clear multiple process’ log files
clear all
clear all process’ log files
fg <pr­oce­ss>
connect to a process in foreground mode Press Ctrl+C to exit foreground
pid
get the PID of superv­isord
pid <na­me>
get the PID of a single child process by name
pid all
get the PID of every child process, one per line
reload
restarts the remote superv­isord
reread
reload the daemon’s config­uration files, without add/remove (no restarts)
restart <na­me>
restart a process
restart <gn­ame­>:*
restart all processes in a group
restart <na­me> <na­me>
restart multiple processes
restart all
restart all processes
signal
No help on signal
start <na­me>
start a process
start <gn­ame­>:*
start all processes in a group
start <na­me> <na­me>
start multiple processes
start all
start all processes
status
get all process status info
status <na­me>
get status on a single process by name
status <na­me> <na­me>
get status on multiple named processes
stop <na­me>
stop a process
stop <gn­ame­>:*
stop all processes in a group
stop <na­me> <na­me>
stop multiple processes or groups
stop all
stop all processes
tail [-f] <na­me> [stdou­t|s­tderr]
output the last part of process logs
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          More Cheat Sheets by misterrabinhalder

          RPM Cheat Sheet