From ec917a4c9df26ee09c0cc11e171e787dde431f14 Mon Sep 17 00:00:00 2001 From: RRRosmontis Date: Tue, 22 Sep 2026 11:29:56 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E8=AF=B4=E6=98=8E=E5=A6=82=E4=BD=95?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E7=B3=BB=E7=BB=9F=E6=9B=B4=E6=96=B0=E6=89=93?= =?UTF-8?q?=E6=96=AD=E6=97=A5=E5=B8=B8=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 主机上的 unattended-upgrades 在 06:20-06:50 运行,needrestart 会重启仍映射旧库的服务, 可能与 04:00-06:35 的日常任务窗口重叠并打断当次执行(实测 2026-09-22 libexpat1 升级 导致 API 服务在 06:20:58 被外部重启)。补充 needrestart 排除配置的写法与检查方式。 --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index ffd48da..cfbd7b5 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,20 @@ Environment=MALLOC_TRIM_THRESHOLD_=131072 # 收缩堆顶 其他同样未启用的选项:在 `backend/server.py` 里定期调用 `libc.malloc_trim(0)`(仅当空闲块位于堆顶 时有效,开销极低);降低 `MAA_ONLINE_FPS` 或分辨率以减少每帧缓冲的分配频率。 +### 防止系统更新打断任务(needrestart) + +如果主机启用了 `unattended-upgrades`,升级完库之后 `needrestart` 会重启仍在使用旧库的服务。 +这类重启若落在日常任务窗口内,会直接打断当次执行,建议把 MAA 单元排除: + +``` +/etc/needrestart/conf.d/99-maa-online.conf +$nrconf{override_rc}{qr(^maa-.*\.service$)} = 0; +``` + +`override_rc` 为假值时 needrestart 会把该单元记入 skipped 并跳过重启。API 服务本身有 +`Restart=always`,且每天 03:59 与每次任务结束后都会主动回收,不需要外部重启。 +检查方式:升级时段执行 `journalctl --since '-10 min' | grep -iE 'needrestart|Restarting services'`。 + ## 离线测试 启动假后端: