[Go]go语言实战-go版本的supervisord编译安装与运行

前端之家收集整理的这篇文章主要介绍了[Go]go语言实战-go版本的supervisord编译安装与运行前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

当需要实现守护进程,以及自己开发的命令自动崩溃重启时,可以使用go版本的supervisord,比python版本依赖少一些

git clone https://github.com/ochinchina/supervisord.git
env GOOS=linux GOARCH=amd64 go build -o supervisord_linux_amd64  64位版本

env GOOS=linux GOARCH=386 go build -o supervisord_linux_386  32位版本

配置命令

vim supervisor.ini

[inet_http_server]
port = :8082

[program:go-fly]
directory = /var/www/html/go-fly/
command = ./main -port 8081

  

执行

./supervisord_linux_386 -c supervisor.ini -d

可以看到go-fly的进程已经被启动了,并且kill掉以后会自动重启

测试地址:

https://gofly.sopans.com/index

 

 

猜你在找的Go相关文章