Merge pull request 'Keep recovered services alive when the watchdog oneshot exits (KillMode=process)' (#401) from feature/svc-autorecover into main
ci / test-pg (push) Successful in 1m0s
ci / test (push) Successful in 2m30s

This commit was merged in pull request #401.
This commit is contained in:
2026-10-11 22:21:27 +00:00
3 changed files with 44 additions and 0 deletions
File diff suppressed because one or more lines are too long
+3
View File
@@ -3734,6 +3734,9 @@ wd_service_text() {
"" \
"[Service]" \
"Type=oneshot" \
"# KillMode=process:oneshot 结束时只回收脚本自身——默认 control-group 会把" \
"# recover 刚拉起的服务一并杀掉(2026-10-11 实测:recover ok 后进程立即消失)。" \
"KillMode=process" \
"ExecStart=$1/scripts/svc.sh recover --quiet" \
"Nice=5"
}
+2
View File
@@ -372,6 +372,8 @@ class SvcAutoRecoverTests(unittest.TestCase):
self.assertIn("OnUnitActiveSec=60s", result.stdout)
self.assertIn("OnBootSec=1min", result.stdout)
self.assertIn("WantedBy=timers.target", result.stdout)
# oneshot 结束不得连带杀掉刚拉起的服务(cgroup 陷阱)。
self.assertIn("KillMode=process", result.stdout)
# 只打印,不落盘(受控 XDG_CONFIG_HOME 下无单元文件)。
unit_dir = self.root / "xdg" / "systemd" / "user"
self.assertFalse((unit_dir / "agent-system-svc-recover.timer").exists())