Files
CyberGril/docs/rework/hel910/tools/snapshot.sh
T

38 lines
1.7 KiB
Bash

#!/usr/bin/env bash
# HEL-910:窗口前/后状态快照(只读)
# 用法: snapshot.sh pre|post
set -u
BASE=/opt/cybergril-hel910
OUT=$BASE/snapshots/$1-$(date -u +%H%M%S).txt
{
echo "== HEL-910 $1 snapshot $(date -u +%FT%TZ) =="
echo "-- ports (83xx/80xx/98xx/788x/10095) --"
ss -ltnp | grep -E ':(8[03][0-9]{2}|98[0-9]{2}|788[0-9]|10095) ' || echo none
echo "-- our pids --"
for f in api bridge worker tts9880; do
p=$BASE/logs/$f.pid
if [ -f "$p" ]; then P=$(cat "$p"); if kill -0 "$P" 2>/dev/null; then echo "$f pid $P alive: $(tr '\0' ' ' < /proc/$P/cmdline | cut -c1-120)"; else echo "$f pid $P dead"; fi; else echo "$f no pidfile"; fi
done
echo "-- livekit rooms --"
curl -s --max-time 5 -H 'Authorization: Bearer skip' http://127.0.0.1:7880/twirp/livekit.RoomService/ListRooms -X POST -H 'Content-Type: application/json' -d '{}' 2>/dev/null | head -c 300 || true
echo
echo "-- voices.json hash + builtin count --"
sha256sum /opt/voice-agent/cosyvoice/voices.json
python3 - <<'EOF'
import json
try:
d = json.load(open('/opt/voice-agent/cosyvoice/voices.json'))
ids = list(d.keys()) if isinstance(d, dict) else [x.get('id') for x in d]
print('entries:', len(ids), 'ids:', ids, 'cg- entries:', sum(1 for i in ids if str(i).startswith('cg-')))
except Exception as e:
print('voices.json read error:', e)
EOF
echo "-- gpu --"
nvidia-smi --query-gpu=memory.used,memory.total --format=csv,noheader
echo "-- 8300/8310/8320/8350 untouched check --"
ss -ltn | grep -E ':(8300|8310|8320|8350) ' || echo 'WARN: expected demo ports missing'
echo "-- tts.log size --"
stat -c '%s bytes %y' /opt/voice-agent/cosyvoice/tts.log 2>/dev/null || echo no-log
} > "$OUT" 2>&1
cat "$OUT"