小白教程
所有教程
关于
Search
172.70.100.139
172.70.100.139
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Golang Gin 使用Systemd管理服务重启和防止挂掉”的源代码
本页内容
上一节:
Golang_Gin_部署上线
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
[[分类:Golang Gin Web 框架教程]] 当我们将服务编译好后再线上需要长期保持进程一直工作,这个时候最好基于systemd去管理进程。 == Systemd 配置 == 添加下面内容到gin_app.service文件 <sample title="" desc=""> [Unit] Description=gin_app Service After=network.target [Service] Type=simple User=www Restart=always RestartSec=5s ExecStart=gin_app ExecReload=kill $(pidof gin_app) ; gin_app [Install] WantedBy=multi-user.target </sample> <sample title="接着开启该服务" desc=""> systemctl --user enable /home/app/gin_app.service </sample> <sample title="启动服务" desc="" > systemctl start gin_app.service </sample> <sample title="重启服务" desc="" > systemctl restart gin_app.service </sample> <sample title="关闭服务" desc="" > systemctl restart gin_app.service </sample>
返回至“
Golang Gin 使用Systemd管理服务重启和防止挂掉
”。
上一节:
Golang_Gin_部署上线