当需要实现守护进程 , 以及自己开发的命令自动崩溃重启时,可以使用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]go语言实战-go版本的supervisord编译安装与运行

 

相关文章:

  • 2021-04-29
  • 2021-05-09
  • 2021-05-12
  • 2021-12-29
  • 2022-01-13
  • 2021-11-22
  • 2021-09-15
  • 2021-08-23
猜你喜欢
  • 2021-05-05
  • 2021-04-05
  • 2021-08-26
  • 2021-07-05
  • 2021-09-04
  • 2021-09-29
  • 2021-11-22
相关资源
相似解决方案