Golang Gin 使用Systemd管理服务重启和防止挂掉:修订历史

本页内容

差异选择:选中要对比的版本的单选按钮,按Enter键或下方的按钮。
说明:(当前)=与最后版本之间的差异,(之前)=与上一版本之间的差异,=小编辑。

2022年9月28日 (星期三)

  • 当前之前 13:382022年9月28日 (三) 13:38Neo 讨论 贡献 809字节 +809 创建页面,内容为“当我们将服务编译好后再线上需要长期保持进程一直工作,这个时候最好基于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=…”