仰望星辰工作室

miaopanel

miaopanel/ scripts/check-sites.sh 1.0 KB · 25 行 原始文件
1#!/usr/bin/env bash
2# Read-only: list sites and verify their document roots still exist.
3set -uo pipefail
4ENTRY="${1:-ipdduiyy}"
5BASE="http://127.0.0.1:8888/$ENTRY"
6PASS=$(awk -F': ' '/^password:/{print $2}' /www/server/panel/data/initial_password.txt)
7
8curl -s -c /tmp/ck.txt -H 'Content-Type: application/json' -H 'Origin: http://127.0.0.1:8888' \
9 -d "{\"username\":\"admin\",\"password\":\"$PASS\"}" "$BASE/api/v1/auth/login" >/dev/null
10curl -s -b /tmp/ck.txt "$BASE/api/v1/sites" > /tmp/sites.json
11python3 - <<'PY'
12import json, os
13sites = json.load(open('/tmp/sites.json'))['data']
14print('sites:', len(sites))
15for s in sites:
16 root = s['root']
17 print('%-4s %-18s %-6s %-10s %-28s %s' % (
18 s['id'], s['name'], s['kind'], s['status'], ','.join(s['domains']), 'OK' if os.path.isdir(root) else 'MISSING'))
19PY
20echo "--- /www/wwwroot ---"
21ls -la /www/wwwroot
22echo "--- units ---"
23ls /etc/systemd/system/miaopanel-site-*.service 2>/dev/null
24echo "--- services ---"
25systemctl list-units 'miaopanel-site-*' --no-legend --no-pager 2>/dev/null | head