This article describes how to use the python process management tool supervisor. This article describes how to install, configure, and use the supervisor. If you need a script, you can write a script, what should we do if we want to go to the backend for execution?
The Code is as follows:
Nohup python example. py 2> & 1/dev/null &
Tumx or screen? However, it may not work well. Today, let's look at a process management tool supervisor in python:
Said: Supervisor: A Process Control System
To put it bluntly, He is a demon program. He can help us complete the script or program we want to host, and take good care of it;
1. Installation
Python is well installed. If it is a centos series, you can use:
The Code is as follows:
Yum install supervisor
For the debin series:
The Code is as follows:
Apt-get install supervisor
Or simply click:
The Code is as follows:
Easy_install supervisor
Pip install supervisor
2. Create a configuration file
You can use the built-in tool echo_supervisord_conf.
It is created under/etc by default, but you need to have the root permission:
The Code is as follows:
Echo_supervisord_conf>/etc/supervisord. conf
Of course, it can also be another directory, but it must be specified at startup (-c)
3. Start Supervisor
Next, let's take a look at how to start supervisord and supervisorctl.
First, find a program to host, such as/bin/date.
The Code is as follows:
Vim/etc/supervisord. conf
[Program: test]
Command = python/root/test_supervisor.py
Process_name = % (program_name) s
Stdout_logfile =/root/test. log
Stderr_logfile =/root/test. log
Save and start:
The Code is as follows:
/Usr/bin/supervisord-c/etc/supervisord. conf
Sending signal:
It's so cool. Next, you can play it freely...
Http://supervisord.org/This is the official website.
At last, he can manage the interface, which also provides a way for us to manage processes on the interface!