SUPERVISOR--A Process Control System
GitHub Address: Https://github.com/Supervisor/supervisor
Can turn a normal command-line process into a background daemon is this true?? Such a cow!
You can use the Supervisor Process Monitoring tool to monitor the process, and if the process dies, the implementation can restart the process. The following article is good:
Https://www.cnblogs.com/zhaoding/p/6257363.html
The following is Supervisor's official website: http://supervisord.org/
Refer to the following article, Link: http://blog.csdn.net/ACxlm/article/details/62889460
Objective
Supervisor is a set of common process management programs developed in Python that can turn a normal command-line process into a background daemonand monitor the status of the process, which can be restarted automatically when the exception exits.
Installation
We can install a program called Supervisor on your Ubuntu to manage the startup of your scripts.
sudo apt-get install Supervisor
After installation we can find the supervisord.conf configuration file in/etc/supervisor/directory, we can use the following command to edit
sudo gedit/etc/supervisor/supervisord.conf
Configuration
At the end of the supervisord.conf this file, add the following:
[program:you program Name]//Your application name, casually named
command=python/home/pi/test.py//Your command can be any command that runs on the terminal
Autostart=true//Auto-start
Autorestart=true
User=root
Log_stderr=true
Logfile=/var/log/testpy.log//The address of the log file
Set Supervisor Boot
We need to edit the rc.local file in/etc and let the supervisor boot up. This allows the script to start running with supervisor at boot time.
sudo gedit/etc/rc.local
In the front row of exit 0 of this profile, add the service supervisor start to save.
Python Supervisor Process Monitoring tool usage