69 lines
2.1 KiB
Bash
69 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
# 一键体检:网络 / 端口 / adb / ffmpeg / docker / 服务状态(模块化输出)
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
REPO="$(cd "$ROOT/.." && pwd)"
|
|
# shellcheck source=/dev/null
|
|
source "$ROOT/scripts/lib/common.sh"
|
|
|
|
echo "=== Live Platform Doctor ==="
|
|
echo "arch: $(detect_arch)"
|
|
echo "hostname: $(hostname -f 2>/dev/null || hostname)"
|
|
|
|
section() { echo ""; echo "--- $1 ---"; }
|
|
|
|
section "loopback / DNS"
|
|
ping -c1 -W2 127.0.0.1 >/dev/null 2>&1 && echo "ping 127.0.0.1: ok" || echo "ping 127.0.0.1: fail"
|
|
getent hosts live.local >/dev/null 2>&1 && echo "live.local resolves: yes" || echo "live.local resolves: (optional mdns)"
|
|
|
|
section "config"
|
|
if [[ -f /opt/live/config/system.json ]]; then
|
|
echo "system.json: present"
|
|
else
|
|
echo "system.json: MISSING (run install-core)"
|
|
fi
|
|
if [[ -f /opt/live/generated/system-stack.env ]]; then
|
|
echo "generated env: present"
|
|
else
|
|
echo "generated env: missing"
|
|
fi
|
|
|
|
section "ports (LISTEN)"
|
|
command -v ss >/dev/null 2>&1 && ss -tlnp 2>/dev/null | head -n 40 || netstat -tlnp 2>/dev/null | head -n 40 || true
|
|
|
|
section "adb"
|
|
if command -v adb >/dev/null 2>&1; then
|
|
adb devices -l || true
|
|
else
|
|
echo "adb not installed"
|
|
fi
|
|
|
|
section "ffmpeg"
|
|
command -v ffmpeg >/dev/null 2>&1 && ffmpeg -version | head -n1 || echo "ffmpeg missing"
|
|
|
|
section "docker"
|
|
if command -v docker >/dev/null 2>&1; then
|
|
docker info >/dev/null 2>&1 && echo "docker: daemon ok" || echo "docker: daemon unreachable"
|
|
else
|
|
echo "docker not installed"
|
|
fi
|
|
|
|
section "proxy hint (ShellCrash)"
|
|
if [[ -d /etc/ShellCrash ]]; then
|
|
echo "ShellCrash dir: /etc/ShellCrash"
|
|
else
|
|
echo "ShellCrash dir: not found"
|
|
fi
|
|
|
|
if [[ -f "$REPO/web.py" ]] && command -v curl >/dev/null 2>&1; then
|
|
section "API"
|
|
PORT="${PORT:-8001}"
|
|
curl -sS -m 3 "http://127.0.0.1:${PORT}/health" && echo "" || echo "health check failed on :$PORT"
|
|
section "Port 80 (live-edge / Caddy)"
|
|
systemctl is-active live-edge.service 2>/dev/null || echo "live-edge.service: inactive"
|
|
curl -sS -m 5 -o /dev/null -w "GET http://127.0.0.1/ → http_code=%{http_code}\n" "http://127.0.0.1/" || echo "curl :80 failed"
|
|
fi
|
|
|
|
echo ""
|
|
echo "=== Doctor finished ==="
|