Files

18 lines
758 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# AList Serve Resource 健康检查
# 用法: ./scripts/healthcheck.sh [ALIST_INTERNAL_URL]
set -euo pipefail
ALIST_URL="${1:-http://localhost:5247}"
echo "== AList container =="
docker inspect --format '状态: {{.State.Status}} 健康: {{.State.Health.Status}}' alist-serve-resource 2>/dev/null || echo "container 未运行"
echo "== HTTP 探活 =="
code=$(curl -s -o /dev/null -w '%{http_code}' "${ALIST_URL}/ping" || echo "ERR")
echo "GET /ping -> ${code} (期望 200)"
echo "== 挂载检查 =="
docker exec alist-serve-resource sh -c 'for m in /mnt/Class /mnt/Book /mnt/Comic /mnt/Template; do \
if [ -d "$m" ]; then echo "OK $m"; else echo "MISS $m"; fi; done' 2>/dev/null || echo "无法 exec(container 未运行或无 shell)"