加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

supervisor管理golang程序

发布时间:2020-12-16 18:24:31 所属栏目:大数据 来源:网络整理
导读:1、安装supervisor apt-get install supervisor 2、新建配置/etc/supervisor/conf.d/test.conf 注: directory是可执行文件路径 , command是可执行文件 , stdout_logfile是日志文件 ,autostart表示服务是否需要跟随supervisor启动,autorestart表示当服务

1、安装supervisor

apt-get install supervisor

2、新建配置/etc/supervisor/conf.d/test.conf 注:directory是可执行文件路径command是可执行文件stdout_logfile是日志文件,autostart表示服务是否需要跟随supervisor启动,autorestart表示当服务挂掉的时候是否需要自动重启,user以什么用户执行,redirect_stderr重定向

[program:test]
directory = /opt/golang/work/src/test
command = /opt/golang/work/src/test/test
autostart = true
autorestart=true
startsecs = 5
user = root
redirect_stderr = true
stdout_logfile = /var/log/supervisor/test.log

3、启动

#根据最新的配置文件,启动新配置或有改动的进程,配置没有改动的进程不会受影响而重启。
supervisorctl update
#启动进程
supervisorctl start test
#重启进程
supervisorctl restart test
#停止进程
supervisorctl stop test

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读