Files
wangjia 60ff7cc586 fix(agent): pangolin-agent.service 补 ExecReload,使 systemctl reload 走 SIGHUP 热重载
[Service] 块只有 ExecStart,没有 ExecReload——systemctl reload pangolin-agent
返回「Job type reload is not applicable」,运维只能退回 restart,而 restart 会让
agent 进程内 s.started 复位为 false,首次渲染走冷启动 systemctl restart sing-box,
瞬断全部在线用户。这正是 Task 5 SIGHUP 热重载路径存在的意义所在,却因为 unit 文件
缺一行而完全走不通。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 07:36:11 +08:00

29 lines
1.3 KiB
Desktop File

[Unit]
Description=Pangolin node agent (self-enrolls, manages local sing-box)
Documentation=https://github.com/wangjia/pangolin
After=network-online.target pangolin-server.service
# 软依赖:server 只是「想要先起」,不绑生死。agent 靠 gRPC 自重连,server 重启
# (如部署)绝不能把 agent 一起拖停——之前 Requires= 正是「agent 静默掉线」根因(#8)。
Wants=network-online.target pangolin-server.service
# 关闭重启频率上限,配合 Restart=always 保证永不放弃自愈(StartLimit* 属 [Unit])。
StartLimitIntervalSec=0
[Service]
Type=simple
EnvironmentFile=/etc/pangolin-agent/agent.env
ExecStart=/usr/local/bin/pangolin-agent
# SIGHUP → agent 重读节点本地配置(acl.json/warp.json)并热重渲染,不冷启动
# sing-box、不踢在线用户。没有这行,`systemctl reload` 会报「Job type reload is
# not applicable」,运维只能退回 restart(整进程重启,sing-box 冷启动瞬断全员)。
ExecReload=/bin/kill -HUP $MAINPID
# 始终自愈(崩溃/被依赖停后都拉起);RestartSec 做退避。
Restart=always
RestartSec=5
# The agent calls `systemctl restart sing-box` after rendering config;
# a polkit rule (49-pangolin-singbox.rules) lets the unprivileged pangolin
# user manage *only* sing-box.service.
User=pangolin
[Install]
WantedBy=multi-user.target