\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{misterrabinhalder} \pdfinfo{ /Title (supervisord.pdf) /Creator (Cheatography) /Author (misterrabinhalder) /Subject (Supervisord Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A3A3A3} \definecolor{LightBackground}{HTML}{F3F3F3} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Supervisord Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{misterrabinhalder} via \textcolor{DarkBackground}{\uline{cheatography.com/35799/cs/19115/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}misterrabinhalder \\ \uline{cheatography.com/misterrabinhalder} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 28th March, 2019.\\ Updated 27th March, 2019.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{0.84609 cm} x{4.13091 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Running supervisord}} \tn % Row 0 \SetRowColor{LightBackground} -c FILE & path to supervisord configuration file \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} -n & run supervisord in the foreground \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} -u USER & UNIX username or numeric user id \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} -l FILE & filename path to use as the supervisord activity log \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} -e LEVEL & Valid levels are trace, debug, info, warn, error, and critical \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} -j FILE & filename to which supervisord should write its pid file \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.09494 cm} x{3.88206 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Running supervisorctl}} \tn % Row 0 \SetRowColor{LightBackground} -c FILE & configuration file path \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} -u USER & username to use for authentication with server \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} -p \seqsplit{PASSWORD} & password to use for authentication with server \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} -r & keep a readline history \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.74655 cm} x{4.23045 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Supervisord Signal}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{SIGTERM} & supervisord and all its subprocesses will shut down \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{SIGINT} & supervisord and all its subprocesses will shut down \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{SIGQUIT} & supervisord and all its subprocesses will shut down \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{SIGHUP} & supervisord will stop all processes, reload the configuration from the first config file it finds, and start all processes \tn % Row Count 10 (+ 4) % Row 4 \SetRowColor{LightBackground} \seqsplit{SIGUSR2} & supervisord will close and reopen the main activity log and all child log files \tn % Row Count 13 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Installing supervisord}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Installing With Pip} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}pip install supervisor} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Install On Debian} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}apt-get install supervisor} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Install On Redhat} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}yum install supervisor} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Install On Archlinux} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}pacman -S supervisor} \tn % Row Count 8 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Using Environment Variables}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{[}program:example{]} \newline command=/usr/bin/example -{}-loglevel=\%(ENV\_LOGLEVEL)s} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Environment variables that are present in the environment at the time that supervisord is started can be used in the configuration file using the Python string expression syntax \%(ENV\_X)s} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Using UNIX domain socket}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{[}unix\_http\_server{]} \newline file = /tmp/supervisor.sock \newline chmod = 0777 \newline chown= nobody:nogroup \newline username = user \newline password = 123} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{HTTP server that listens on a UNIX domain socket} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Using process group}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{[}group:foo{]} \newline programs=bar,baz \newline priority=999} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Group "homogeneous" process groups (aka "programs") together into a "heterogeneous" process group} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Using TCP domain socket}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{[}inet\_http\_server{]} \newline port = 127.0.0.1:9001 \newline username = user \newline password = 123} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{HTTP server that listens on a TCP (internet) socket} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Using supervisord}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{[}supervisord{]} \newline logfile = /tmp/supervisord.log \newline logfile\_maxbytes = 50MB \newline logfile\_backups=10 \newline loglevel = info \newline pidfile = /tmp/supervisord.pid \newline nodaemon = false \newline minfds = 1024 \newline minprocs = 200 \newline umask = 022 \newline user = chrism \newline identifier = supervisor \newline directory = /tmp \newline nocleanup = true \newline childlogdir = /tmp \newline strip\_ansi = false \newline environment = KEY1="value1",KEY2="value2"} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Global settings related to the supervisord} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Using supervisorctl}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{[}supervisorctl{]} \newline serverurl = \seqsplit{unix:///tmp/supervisor.sock} \newline username = chris \newline password = 123 \newline prompt = mysupervisor} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Supervisorctl interactive shell program} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Using program}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{[}program:cat{]} \newline command=/bin/cat \newline process\_name=\%(program\_name)s \newline numprocs=1 \newline directory=/tmp \newline umask=022 \newline priority=999 \newline autostart=true \newline autorestart=unexpected \newline startsecs=10 \newline startretries=3 \newline exitcodes=0,2 \newline stopsignal=TERM \newline stopwaitsecs=10 \newline stopasgroup=false \newline killasgroup=false \newline user=chrism \newline redirect\_stderr=false \newline stdout\_logfile=/a/path \newline stdout\_logfile\_maxbytes=1MB \newline stdout\_logfile\_backups=10 \newline stdout\_capture\_maxbytes=1MB \newline stdout\_events\_enabled=false \newline stderr\_logfile=/a/path \newline stderr\_logfile\_maxbytes=1MB \newline stderr\_logfile\_backups=10 \newline stderr\_capture\_maxbytes=1MB \newline stderr\_events\_enabled=false \newline environment=A="1",B="2" \newline serverurl=AUTO} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Supervisord to know which programs it should start and control} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Using configuration directory}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{[}include{]} \newline files = supervisord.d/*.conf} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Include configuration files from drop in directory} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{3.33459 cm} p{1.64241 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Log Level}} \tn % Row 0 \SetRowColor{LightBackground} critical & CRIT \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} error & ERRO \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} warn & WARN \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} info & INFO \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} debug & DEBG \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} trace & TRAC \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} blather & BLAT \tn % Row Count 7 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Supervisorctl actions}} \tn % Row 0 \SetRowColor{LightBackground} help & print a list of available actions \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} help \textless{}action\textgreater{} & print help for \textless{}action\textgreater{} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} add \textless{}name\textgreater{} {[}...{]} & activates any updates in config for process/group \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} remove \textless{}name\textgreater{} {[}...{]} & removes process/group from active config \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} update & reload config and then add and remove as necessary \tn % Row Count 12 (+ 3) % Row 5 \SetRowColor{white} clear \textless{}name\textgreater{} & clear a process' log files \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} clear \textless{}name\textgreater{} \textless{}name\textgreater{} & clear multiple process' log files \tn % Row Count 16 (+ 2) % Row 7 \SetRowColor{white} clear all & clear all process' log files \tn % Row Count 18 (+ 2) % Row 8 \SetRowColor{LightBackground} fg \textless{}process\textgreater{} & connect to a process in foreground mode Press Ctrl+C to exit foreground \tn % Row Count 22 (+ 4) % Row 9 \SetRowColor{white} pid & get the PID of supervisord \tn % Row Count 24 (+ 2) % Row 10 \SetRowColor{LightBackground} pid \textless{}name\textgreater{} & get the PID of a single child process by name \tn % Row Count 27 (+ 3) % Row 11 \SetRowColor{white} pid all & get the PID of every child process, one per line \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Supervisorctl actions (cont)}} \tn % Row 12 \SetRowColor{LightBackground} reload & restarts the remote supervisord \tn % Row Count 2 (+ 2) % Row 13 \SetRowColor{white} reread & reload the daemon's configuration files, without add/remove (no restarts) \tn % Row Count 6 (+ 4) % Row 14 \SetRowColor{LightBackground} restart \textless{}name\textgreater{} & restart a process \tn % Row Count 7 (+ 1) % Row 15 \SetRowColor{white} restart \textless{}gname\textgreater{}:* & restart all processes in a group \tn % Row Count 9 (+ 2) % Row 16 \SetRowColor{LightBackground} restart \textless{}name\textgreater{} \textless{}name\textgreater{} & restart multiple processes \tn % Row Count 11 (+ 2) % Row 17 \SetRowColor{white} restart all & restart all processes \tn % Row Count 12 (+ 1) % Row 18 \SetRowColor{LightBackground} signal & No help on signal \tn % Row Count 13 (+ 1) % Row 19 \SetRowColor{white} start \textless{}name\textgreater{} & start a process \tn % Row Count 14 (+ 1) % Row 20 \SetRowColor{LightBackground} start \textless{}gname\textgreater{}:* & start all processes in a group \tn % Row Count 16 (+ 2) % Row 21 \SetRowColor{white} start \textless{}name\textgreater{} \textless{}name\textgreater{} & start multiple processes \tn % Row Count 18 (+ 2) % Row 22 \SetRowColor{LightBackground} start all & start all processes \tn % Row Count 19 (+ 1) % Row 23 \SetRowColor{white} status & get all process status info \tn % Row Count 21 (+ 2) % Row 24 \SetRowColor{LightBackground} status \textless{}name\textgreater{} & get status on a single process by name \tn % Row Count 23 (+ 2) % Row 25 \SetRowColor{white} status \textless{}name\textgreater{} \textless{}name\textgreater{} & get status on multiple named processes \tn % Row Count 25 (+ 2) % Row 26 \SetRowColor{LightBackground} stop \textless{}name\textgreater{} & stop a process \tn % Row Count 26 (+ 1) % Row 27 \SetRowColor{white} stop \textless{}gname\textgreater{}:* & stop all processes in a group \tn % Row Count 28 (+ 2) % Row 28 \SetRowColor{LightBackground} stop \textless{}name\textgreater{} \textless{}name\textgreater{} & stop multiple processes or groups \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Supervisorctl actions (cont)}} \tn % Row 29 \SetRowColor{LightBackground} stop all & stop all processes \tn % Row Count 1 (+ 1) % Row 30 \SetRowColor{white} tail {[}-f{]} \textless{}name\textgreater{} {[}stdout|stderr{]} & output the last part of process logs \tn % Row Count 3 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}