Example Analysis of Golang process daemon Supervisor
This article mainly introduces the Golang process guardian Supervisor example analysis, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
1. Install Supervisor
Install supervisor
2. Generate Golang executable program
Go to the golang project root directory cd / data/go/test, and run go build-o main main.go to generate the executable program. Optional: use upx main compression again
3. Edit the configuration file of supervisor go
Important: command value "must" absolute path
Important: the directory value must be configured (if there is a configuration file that does not end with go)
See that there are many articles on the Internet that directory is not configured to start successfully. After investigation and reference, it is located that the role of directory is that when the main program starts, switch to this directory and find the configuration file directory of the main program. If the project has a configuration file that does not end with go, this directory is a "must" configuration. Directory function: the configuration file directory when the main program starts
[program:go]; process_name=% (program_name)% (process_num) 02d Command value must be absolute path command=/data/go/test/mainautostart=trueautorestart=trueuser=rootnumprocs=1redirect_stderr=truestdout_logfile=/var/log/supervisor/go.logdirectory=/data/go/test Thank you for reading this article carefully. I hope the article "sample Analysis of Golang process Guardian Supervisor" shared by the editor will be helpful to you. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!