Linux background process management tool: supervisor

1. Installation:

sudo pip install supervisor

2. Generate a configuration file

echo_supervisord_conf > /etc/supervisord.conf

Configuration:

[program:django]
command=python  /opt/Automation_platform/manage.py runserver localhost:8080
user = wanghua.zhou
autostart=true
autorestart=true
startsecs=3
stopasgroup=true
stderr_logfile=/home/wanghua.zhou/log/django/bandwidth_err.log
stdout_logfile=/home/wanghua.zhou/log/django/bandwidth.log

3. Start

sudo supervisord -c /etc/supervisord.conf

4. Process management

sudo supervisorctl start process
sudo supervisorctl stop process
sudo supervisorctl restart process
sudo supervisorctl stop all

It is also possible to enter the supervision console:

sudo supervisorctl
stop django  停止服务
start django 启动服务

5. Restart the service, reload the configuration file to stop and restart all subroutines:

sudo supervisorctl reload

Only restart the subroutine for the configuration update

sudo supervisorctl update

6. Web management

vim /etc/supervisord.conf

Visit: http://10.241.11.223:9001

Enter image description

Enter image description

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326501437&siteId=291194637