Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Golang process daemon Supervisor

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report