Installation and configuration of Supervisor process monitoring and management tools under Mac _python

Source: Internet
Author: User
Tags in python

Supervisor is a process monitoring and management tool under a UNIX-like operating system.

Install Supervisor

Supervisor is written in Python and can be installed directly using Python's Package Installation management tool PIP (Python Package Index):

Copy Code code as follows:

sudo pip install Supervisor

Configure Supervisor

The Supervisor configuration file is named Supervisord.conf, which provides configuration option settings for Supervisord (Supervisor Primary Service command) and SUPERVISORCTL (Supervisor's monitoring Management command). Supervisor does not specify where the configuration file supervisord.conf is located, and the Supervisor service is started by default at:

Copy Code code as follows:

$CWD/supervisord.conf
$CWD/etc/supervisord.conf
/etc/supervisord.conf

These directory locations look for profile supervisord.conf. Supervisor also provides the parameter "-C" to specify the directory path of the configuration file.

Enter the "echo_supervisord_conf" command at the terminal to view the contents of the default configuration of the supervisor.

To generate a default profile:

Copy Code code as follows:

echo_supervisord_conf >/etc/supervisord.conf

Here are the selected settings for some configuration, basically enough, configured as follows:

Copy Code code 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 = 50MB
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 Code code as follows:

Supervisord-c/etc/supervisord.conf

The parameter "-C" indicates the path to the specified supervisor configuration file

Add Supervisord to the system boot service

Copy Code code 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 Code code as follows:

Launchctl Load ~/library/launchagents/dengjoe.supervisord.plist

Supervisorctl Monitoring Command

Supervisorctl is supervisor's own background Process Control tool, and the following are some of the uses of this command:

Start Application:

Copy Code code as follows:

Supervisorctl Start Program

Re-read configuration:

Copy Code code 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.