Configuration and use of Supervisor

Source: Internet
Author: User

Environment: Ubuntu 14.04 LTS http://supervisord.org/
Liunx has a lot of daemon tools, such as Nohup,screen,supervisor, Supervisor is a process management program developed in Python, can be a normal command-line process into the background daemon, abnormal exit can be automatically restarted.
#安装
sudo apt-get install Supervisor
#进程
/usr/bin/supervisord--Supervisor Service Daemon
/usr/bin/supervisorctl--Supervisor Console process
In/etc/ The Supervisor directory contains the Supervisor configuration file: Where CONF.D is a subdirectory that holds configuration information for the supervisor supervised process, a process that has a corresponding configuration file supervisord.conf is the main configuration file for supervisor, Define the service name, interface, and so on.
#配置
Now to monitor a script process with supervisor, create a new configuration file for this script process in/ETC/SUPERVISOR/CONF.D [I deployed a Python and Golang Web program]
Cd/etc/supervisor/conf.d
Touch gogs.conf stock.conf

[Program:gogs]
command=/opt/gogs/scripts/start.sh
Directory=/opt/gogs
Autostart=true
Autorestart=true
Stdout_logfile=/var/log/supervisor/gogs_supervisor_out.log
Stderr_logfile=/var/log/supervisor/gogs__supervisor_err.log

[PROGRAM:STOCKHQ]
Command=python3 __stockhq.py
Directory=/opt/stockhq/data
Autostart=true
Autorestart=true
Startsecs=1
Stderr_logfile=/var/log/stockhq_err.log
Stdout_logfile=/var/log/stockhq_out.log

#保存
: QW
#启动服务
sudo service supervisor Stop
sudo service supervisor Start
#配置更改生效
SUPERVISORCTL Update or Restart Supervisor program with Supervisorctl Reload
#查看状态
Supervisorctl status
#停止所有gogs
Supervisorctl Stop All
#启动gogs
Supervisorctl Start Gogs
#查看3000端口进程
lsof-i:3000
netstat-anl | grep "3000"
#查看某一端口是否开放
Lsof-i:80
NETSTAT-NUPL (UDP-type port)
NETSTAT-NTPL (Port of TCP type)
# View Process
sudo ps-ef | grep Supervisor
#杀死进程
Kill-9 PID
#开启http的UI控制台
Modifying the master configuration file
Vim/etc/supervisor/supervisord.conf, add the following:
[Inet_http_server]
Port = 0.0.0.0:9001 #ip and bound port
Username = Irving # administrator Name
Password = 123456 #管理员密码
In this way, enter the address and port number of the configuration in the browser, enter the configured user name and password, then you can see the Web-based console
Interface. From this, you can view the > information of Supervisor Monitoring, and can see the log of the process.

If the server has an extranet to access, configure your Web server to start listening 0.0.0.0 (not 127.0.01).

Configuration and use of Supervisor

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.