Python process management tool supervisor uses instances

Source: Internet
Author: User
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!

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.