Supervisor the use of process management tools

Source: Internet
Author: User
Tags emit

Supervisor is a process management tool that supervisor comes in handy when you want your app to start up with a boot up, or after the app crashes.

Widely used in the server to boot the control program

After installing the supervisor, you can create a new /etc/supervisord.conf file, the contents of which can be seen through the echo_supervisord_conf Directive .

You can start supervisor with the following command (if you do not specify a configuration file, you will find it in a few directories):

Supervisord-c/etc/supervisord.conf

In the configuration file, you can see the contents of the comment and the configuration of the managed process.

After [include] , you can include your own profile path, so that when supervisor is started, other processes are started according to the configuration file:

=/etc/supervisor/*. conf

For example, in configuration file cat.conf under Supervisor, you can write this (ignoring comments):

[program:theprogramname]; process application name; command=/bin/Cat; process Start command, which involves the use of absolute paths for commands; Process_name=% (program_name) s; Process_nameExpr(Default%(program_name) s); Numprocs=1; Number of processes copies to start (Def1);d irectory=/tmp; in which directory the command is executed; Umask=022; Umask forprocess (default None);p riority=999; The relative start priority (default999); Autostart=trueWhen the supervisor is started, the process also starts; Startsecs=1; No exception after starting n seconds, even if it starts successfully; Startretries=3; If it does not start successfully, you need to retry several times; AutoRestart=unexpected; When supervisor crashes, set to true this process will automatically restart; Exitcodes=0,2;'expected'Exit codes used with AutoRestart (default0,2); Stopsignal=quit; Signal used toKillprocess (default term); Stopwaitsecs=Ten; Max num secs towaitB4 SIGKILL (defaultTen); Stopasgroup=false; Send stop signal to the UNIX process group (defaultfalse); Killasgroup=false; SIGKILL the UNIX process Group (deffalse); user=chrism; user name; Redirect_stderr=true; REDIRECT Proc stderr to stdout (defaultfalse); Stdout_logfile=/a/path; After executing the command, the resulting output file (the file needs to touch beforehand); Stdout_logfile_maxbytes=1MB; max # logfile bytes b4 rotation (default 50MB); Stdout_logfile_backups=Ten; # of StdOut logfile backups (0means none, defaultTen); Stdout_capture_maxbytes=1MB; Number of bytesinch 'Capturemode'(Default0); stdout_events_enabled=false; Emit events on StdOut writes (defaultfalse); Stderr_logfile=/a/path; After executing the command, the output file of the error message
; Stderr_logfile_maxbytes=1MB; max # logfile bytes b4 rotation (default 50MB); Stderr_logfile_backups=Ten; # of stderr logfile backups (0means none, defaultTen); Stderr_capture_maxbytes=1MB; Number of bytesinch 'Capturemode'(Default0); stderr_events_enabled=false; Emit events on StdErr writes (defaultfalse); Environment=a="1", b="2"; Process Environment Additions (def no adds); ServerURL=auto; Override ServerURL computation (childutils)

If not explicitly specified, the default configuration is used

You can configure the supervisor to start as the host starts, enabling the delivery of the application initiated by the host startup->supervisor startup .

About Supervisorctl:

Supervisorctl is a client of Supervisord and can be specified to start with the same configuration file as Supervisord (if you do not specify it will go to a specific directory to find the configuration file):

Supervisorctl-c/etc/supervisord.conf

Some of the common commands in supervisorctl are as follows:

Status: View program status

stop/restart/start XXX : Stop/reboot/start XXX

Update XXX application modified after XXX configuration file

Supervisor the use of process management tools

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.