Home  >  Article  >  Backend Development  >  A brief introduction to supervisor

A brief introduction to supervisor

零下一度
零下一度Original
2017-06-29 10:40:461398browse

Supervisor can be used to protect processes running under Linux, providing start/stop/restart and other functions to ensure that the process is not accidentally killed by other processes.

  • First apt-get install supervisor

  • supervisord is the daemon main program, which generates the default configuration file echo_supervisord_conf > /etc/supervisord.conf, Start the service supervisord -c /home/supervisord.conf

  • Open supervisorctl and find that there are no monitored services.

  • Now write the process configuration to be managed, similar to the following

  • [program:gftrader]command=python3 /home/gftrader/runStrategy.py
    directory=/home/gftrader/
    autorestart=true
    log_stdout=true
    log_stderr=true
    exitcodes=0,2stopsignal=QUIT
    stopwaitsecs=10stdout_logfile=/tmp/gftrader.log

  • supervisorctl reread, then update, status checks the status, help can look at other commands

The above is the detailed content of A brief introduction to supervisor. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn