Install and configure the Supervisor process monitoring management tool on Mac

Source: Internet
Author: User

Install and configure the Supervisor process monitoring management tool on Mac

Supervisor is a process monitoring and management tool in unix-like operating systems.

Install Supervisor

The Supervisor is written in Python and can be directly installed using the Python Package installation management tool pip (Python Package Index:

Copy codeThe Code is as follows:
Sudo pip install supervisor

Configure a Supervisor

The configuration file of the Supervisor is named supervisord. conf, which provides configuration option settings for supervisord (the main service command of the Supervisor) and supervisorctl (the Monitoring and Management command of the Supervisor. The Supervisor does not specify the storage location of the configuration file supervisord. conf. By default, when the Supervisor service is started:

Copy codeThe Code is as follows:
$ CWD/supervisord. conf
$ CWD/etc/supervisord. conf
/Etc/supervisord. conf

Find the configuration file supervisord. conf in these directories. The Supervisor also provides the "-c" parameter to specify the directory path of the configuration file.

Enter the "echo_supervisord_conf" command on the terminal to view the default configurations of the Supervisor.

Generate a default configuration file:

Copy codeThe Code is as follows:
Echo_supervisord_conf>/etc/supervisord. conf

Some configurations are selected here, which are adequate. The configuration is as follows:

Copy codeThe Code is as follows:
[Inet_http_server]
Port = 127.0.0.1: 9001
Username = dhq
Password = 123456
 
[Unix_http_server]
File =/tmp/supervisor. sock
Chmod= 0700
 
[Supervisord]
Logfile =/Users/dengjoe/. supervisor/supervisord. log
Logfile_maxbytes = 50 MB
Logfile_backups = 10
Loglevel = info
Pidfile =/tmp/supervisord. pid
Nodaemon = False
Minfds= 1024
Minprocs = 200
Umask = 022
Identifier = supervisor
Directory =/tmp
Nocleanup = true
Childlogdir =/tmp
 
[Supervisorctl]
Serverurl = unix: // tmp/supervisor. sock
 
[Rpcinterface: supervisor]
Supervisor. rpcinterface_factory = supervisor. rpcinterface: make_main_rpcinterface
 
 
 
[Program: shadowsocks]
Directory =/Users/dengjoe/shadowsocks
Command =/usr/bin/python/Users/dengjoe/shadowsocks/local. py
Autostart = true
Autorestart = true

Start Supervisor

Copy codeThe Code is as follows:
Supervisord-c/etc/supervisord. conf

The "-c" parameter specifies the path of the Supervisor configuration file.

Add supervisord to the system startup Service

Copy codeThe Code is as follows:
<? Xml version = "1.0" encoding = "UTF-8"?>
<! DOCTYPE plist PUBLIC "-// Apple // dtd plist 1.0 // EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<Plist version = "1.0">
<Dict>
<Key> KeepAlive </key>
<Dict>
<Key> SuccessfulExit </key>
<False/>
</Dict>
<Key> Label </key>
<String> dengjoe. supervisord </string>
<Key> ProgramArguments </key>
<Array>
<String>/usr/local/bin/supervisord </string>
<String>-n </string>
<String>-c </string>
<String>/etc/supervisord. conf </string>
</Array>
<Key> RunAtLoad </key>
<True/>
</Dict>
</Plist>

Start the Supervisor service:

Copy codeThe Code is as follows:
Launchctl load ~ /Library/LaunchAgents/dengjoe. supervisord. plist

Supervisorctl monitoring command

Supervisorctl is a background process control tool provided by the Supervisor. The following describes how to use this command:

Start the application:

Copy codeThe Code is as follows:
Supervisorctl start program

Re-read Configuration:

Copy codeThe Code is as follows:
Supervisorctl update

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.