Home > Backend Development > Golang > Let's talk about Golang process guardian Supervisor

Let's talk about Golang process guardian Supervisor

藏色散人
Release: 2021-10-28 19:16:46
forward
2971 people have browsed it

This article is written by the go language tutorial column to talk about the Golang process guardian Supervisor. I hope it will be helpful to friends in need!

Let's talk about Golang process guardian Supervisor

1. Install Supervisor

Install supervisor

2. Generate Golang executable program

Enter the golang project root directory cd /data/go/test, run go build -o main main.go to generate an executable program, optional: then use upx main to compress

3. Edit the configuration file of supervisor go

  • Key point: command value "must" absolute path

  • Key point: directory value [Required] configuration (required when there is a configuration file ending with non-go)
    I saw many articles on the Internet that can be successfully started without configuring the directory. After investigation and review of information, it was determined that the function of the directory is to start the main program. , switch to this directory and look for the configuration file directory of the main program. If there is a configuration file with a non-go ending in the project, this directory is a "must" configuration. Directory role: the configuration file directory when the main program starts

    [program:go];process_name=%(program_name)s_%(process_num)02d; command 值『必须』为绝对路径command=/data/go/test/mainautostart=trueautorestart=trueuser=rootnumprocs=1redirect_stderr=truestdout_logfile=/var/log/supervisor/go.logdirectory=/data/go/test
    Copy after login

    If there is a better way for supervisor to configure golang or other welcome messages

More golang related knowledge, Please visit golangtutorial column!

The above is the detailed content of Let's talk about Golang process guardian Supervisor. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:learnku.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template