diff --git a/docs/install-profiles.md b/docs/install-profiles.md index 8bded5e..48e0f72 100644 --- a/docs/install-profiles.md +++ b/docs/install-profiles.md @@ -19,6 +19,12 @@ cd /home/live/douyinyoutube # 或你的克隆路径 sudo bash upgrade-live.sh ``` +若仓库只更新了 **`live-console.service` 模板**(例如 `StartLimitIntervalSec`),可单独刷新单元: + +```bash +sudo bash refresh-live-unit.sh +``` + ## What Each Script Does ### `install-hub.sh` diff --git a/refresh-live-unit.sh b/refresh-live-unit.sh new file mode 100644 index 0000000..efed174 --- /dev/null +++ b/refresh-live-unit.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +ROOT_DIR="$(cd "$(dirname "$0")" && pwd)" +exec bash "$ROOT_DIR/scripts/linux/refresh_live_console_unit.sh" "$@" diff --git a/scripts/linux/lib/common.sh b/scripts/linux/lib/common.sh index ce29e39..3b9bb9c 100644 --- a/scripts/linux/lib/common.sh +++ b/scripts/linux/lib/common.sh @@ -254,6 +254,8 @@ Environment=PORT=$PORT ExecStart=$ROOT_DIR/start.sh Restart=always RestartSec=5 +# 避免构建/依赖短暂失败时触发 systemd 默认「5 次/10s」后永久停跑(表现为 live-edge 502、:8001 无监听) +StartLimitIntervalSec=0 [Install] WantedBy=multi-user.target diff --git a/scripts/linux/probe_live_access.sh b/scripts/linux/probe_live_access.sh index bbaffe1..084c844 100644 --- a/scripts/linux/probe_live_access.sh +++ b/scripts/linux/probe_live_access.sh @@ -64,3 +64,15 @@ echo "2) Try: http://${LAN_IP}:${PORT}/ (direct control plane, bypasses :80 a echo "3) live.local needs mDNS (Android often OK; Windows may need Bonjour or use IP)." echo "4) If OK on IP but not live.local: Avahi on this host — systemctl status avahi-daemon" echo "" + +if ! systemctl is-active live-console.service >/dev/null 2>&1; then + echo "=== Fix live-console (your case: edge OK, :${PORT} down) ===" + echo "sudo systemctl reset-failed live-console.service 2>/dev/null || true" + echo "sudo systemctl enable --now live-console.service" + echo "sleep 3 && curl -sf http://127.0.0.1:${PORT}/health && echo OK || echo still failing — logs:" + echo "sudo journalctl -u live-console.service -n 80 --no-pager" + echo "" + echo "After git pull / code update, prefer: sudo bash upgrade-live.sh" + echo "Only systemd unit changed? sudo bash refresh-live-unit.sh" + echo "" +fi diff --git a/scripts/linux/refresh_live_console_unit.sh b/scripts/linux/refresh_live_console_unit.sh new file mode 100644 index 0000000..4966113 --- /dev/null +++ b/scripts/linux/refresh_live_console_unit.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# git pull 后若只改了 systemd 模板(如 StartLimit),执行本脚本重写 live-console.service 并 enable --now +set -euo pipefail + +SELF_DIR="$(cd "$(dirname "$0")" && pwd)" +INSTALL_TAG="refresh-unit" +. "$SELF_DIR/lib/common.sh" + +ensure_root "$@" +load_env +log "Rewriting /etc/systemd/system/live-console.service from repo" +install_live_console_service +log "Done. Check: systemctl status live-console.service --no-pager"