From 4317dd9a02e7fac909b093aaa4bb8bb159b36dbd Mon Sep 17 00:00:00 2001 From: hy Date: Thu, 23 Apr 2026 12:44:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E4=B8=80=E9=94=AE=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E5=AE=B9=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ops/deploy_via_tat.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ops/deploy_via_tat.py b/ops/deploy_via_tat.py index 94ecbad..3951674 100755 --- a/ops/deploy_via_tat.py +++ b/ops/deploy_via_tat.py @@ -220,11 +220,23 @@ python3 -m venv .venv .venv/bin/pip install --quiet --disable-pip-version-check -r requirements-ops.txt bash scripts/install_systemd.sh -systemctl reset-failed hy-app-monitor-yumi.service hy-app-monitor-haiyi.service hy-app-monitor.service || true -systemctl restart hy-app-monitor-yumi.service hy-app-monitor-haiyi.service hy-app-monitor.service -systemctl is-active hy-app-monitor-yumi.service -systemctl is-active hy-app-monitor-haiyi.service -systemctl is-active hy-app-monitor.service + +restart_unit() {{ + local unit="$1" + # 先清理一次可能残留的 start-limit 状态。 + systemctl reset-failed "$unit" || true + # 优先直接重启;如果被限流或中途失败,再补一次 reset/start。 + if ! systemctl restart "$unit"; then + systemctl reset-failed "$unit" || true + systemctl start "$unit" + fi + # 每个服务都单独校验 active,避免批量命令掩盖具体失败项。 + systemctl is-active "$unit" +}} + +restart_unit hy-app-monitor-yumi.service +restart_unit hy-app-monitor-haiyi.service +restart_unit hy-app-monitor.service ss -lntp | grep ":$APP_PORT" || true """