Supervisor Process Manager Configuration Guide

Source: Internet
Author: User
Tags arithmetic terminates

Supervisor Process Manager Configuration Guide1. Supervisor Introduction1.1. Official website

http://supervisord.org/

1.2. Introduction

Supervisor is a Process control system. It is a C/s system (Note: It provides a web interface to users to query and control), it allows users to monitor and control the process of Unix-like systems. Its target is somewhat similar to Launchd, Daemontools and Runit, but unlike them, it is not run as init (the process number PID is 1). It is used to control the process, and it does not have two general procedures when it is started.

2. Installation and Configuration2.1. Installation
$apt-get Install Python-pip$easy_install supervisor$echo_supervisord_conf >/etc/supervisord.conf
2.2. Configuration
$nano/etc/supervisord.conf
2.3. (program) configuration template
[program:cat]command=/bin/catprocess_name=% (Program_name) snumprocs=1directory=/tmpumask=022priority= 999autostart=trueautorestart=truestartsecs=10startretries=3exitcodes=0,2stopsignal=termstopwaitsecs=10user= Chrismredirect_stderr=falsestdout_logfile=/a/pathstdout_logfile_maxbytes=1mbstdout_logfile_backups=10stdout_ Capture_maxbytes=1mbstderr_logfile=/a/pathstderr_logfile_maxbytes=1mbstderr_logfile_backups=10stderr_capture_ Maxbytes=1mbenvironment=a= "1", b= "2" Serverurl=auto

Simplify templates

[Program:test]command=python test.pydirectory=/home/supervisor_test/autorestart=truestopsignal=intuser= rootstdout_logfile=test_out.logstdout_logfile_maxbytes=1mbstdout_logfile_backups=10stdout_capture_maxbytes= 1mbstderr_logfile=test_err.logstderr_logfile_maxbytes=1mbstderr_logfile_backups=10stderr_capture_maxbytes=1mb
2.4. (program) configuration instructions
* for required fields; *[program: Apply name][program:cat];* command path, if the program started with Python should be  python /home/test.py, ; not recommended to put/ home/user/,  for non-user users generally cannot access command=/bin/cat; When Numprocs is 1 o'clock, process_name=% (program_name) s; when numprocs>= 2 o'clock,% (program_name) s_% (process_num) 02dprocess_name=% (program_name) s; number of processes Numprocs=1; execution directory, if any/home/supervisor_test /test1.py; set directory to/home/supervisor_test; command needs to be set to python test1.py; otherwise the command must be set to absolute execution of the directory directory=/ tmp; Mask:--- -w- -w-,  after conversion rwx r-x w-xumask=022; priority, the higher the value, the last start, the first is closed, the default value 999priority=999; If true, when supervisor starts, the program will automatically start autostart=true;* automatically restart the autorestart=true, start the delay execution, default 1 seconds startsecs=10, the number of start attempts, Default 3 times startretries=3; When the exit code is 0, 2 o'clock, the reboot is performed, the default value 0,2exitcodes=0,2; stop signal, default term; Interrupt: INT (similar to CTRL + C) (Kill -int pid), After exiting, the file or log will be written (recommended); Termination: term (KILL -TERM PID); Pending: HUP (kill -hup pid), note with Ctrl+z/kill -stop  pid different; calmly stop: Quit (kill -quit pid); KILL, USR1, USR2 other See commands (KILL -L), stating that 1stopsignal=termstopwaitsecs=10;* performs the use with the root userR=root; REDIRECT Redirect_stderr=falsestdout_logfile=/a/pathstdout_logfile_maxbytes=1mbstdout_logfile_backups= 10stdout_capture_maxbytes=1mbstderr_logfile=/a/pathstderr_logfile_maxbytes=1mbstderr_logfile_backups=10stderr_ CAPTURE_MAXBYTES=1MB: Environment variable setting environment=a= "1", b= "2" Serverurl=auto
2.5. (inet_http_server) configuration instructions

You can use your browser to view and control process status

[Inet_http_server]; inet (TCP) server disabled by defaultport=0.0.0.0:9001; (Ip_address:port specifier, *:p ort for all iface) Username=user; User name (default is no username (open server)) password=123; Password (default is no password (open server))
3. Start and close3.1. Start Supervisord
$supervisord-C/etc/supervisord.conf
3.2. Close Supervisord
$supervisorctl shutdown
3.3. Reload the configuration
$supervisorctl Reload
Illustration 1:

Common Signal Description-Original

sighup
signal name number means description
1 terminal hangs or controls process termination. When the user exits the shell, all processes initiated by the process receive this signal, and the default action is to terminate the process.
SIGINT 2 keyboard interrupted. When the user presses the key combination, the user terminal sends this signal to the running program that is started by the terminal. The default action is to terminate the process.
sigquit 3 keyboard exit key is pressed. When a user presses or combines a key, the user terminal sends this signal to the running program that is started by the terminal. The default action is to exit the program.
SIGFPE 8 is emitted when a fatal arithmetic error occurs. This includes not only floating-point arithmetic errors, but also overflow and all algorithmic errors such as divisor 0. The default action is to terminate the process and produce a core file.
SIGKILL 9 terminates the process unconditionally. The process receives the signal immediately terminates without cleanup and staging work. The signal cannot be ignored, processed, and blocked, and it provides the system administrator with a way to kill any process.
sigalrm + timer timeout, the default action is to terminate the process.
SIGTERM all program end signal, can be generated by the KILL command. Unlike Sigkill, SIGTERM signals can be blocked and terminated so that the program can save work or clean up temporary files before exiting.
$ kill -l 1)  sighup     2)  SIGINT      3)  sigquit     4)  sigill     5)  SIGTRAP  6)  sigabrt     7)  sigbus     8)  SIGFPE      9) ( sigkill    10)  sigusr111)  SIGSEGV     12) ( sigusr2    13)  sigpipe    14)   SIGALRM    15)  sigterm16)  sigstkflt    17)  SIGCHLD     18)  sigcont    19)  sigstop    20)  SIGTSTP21)  sigttin    22)  sigttou    23)  SIGURG     24) ( sigxcpu    25)  sigxfsz26)  SIGVTALRM     27)  SIGPROF&Nbsp;   28) ( sigwinch    29)  sigio    30)   SIGPWR31)  sigsys    34)  sigrtmin    35)  SIGRTMIN+1     36)  sigrtmin+2    37)  sigrtmin+338)  SIGRTMIN+4     39)  sigrtmin+5    40)  SIGRTMIN+6     )  sigrtmin+7    42)  sigrtmin+843)  sigrtmin+9    44)  sigrtmin+10    45)  sigrtmin+11    46)  SIGRTMIN+12     47)  sigrtmin+1348)  sigrtmin+14    49)  SIGRTMIN+15     50)  sigrtmax-14    51)  SIGRTMAX-13     52) ( sigrtmax-1253)  sigrtmax-11    54)  SIGRTMAX-10     55)  sigrtmax-9    56) ( sigrtmax-8    57)  sigrtmax-758)  SIGRTMAX-6     59) ( sigrtmax-5    60)  sigrtmax-4    61)   sigrtmax-3    62) ( sigrtmax-263)  sigrtmax-1    64)   Sigrtmax

Supervisor Process Manager Configuration Guide

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.