Files
2026gaokaozhiyuan/verify_portal.py
T
simon b6df028839 v1.0.0 高考志愿门户完整修复
变更摘要:
- [fix] 清理根目录 index.html 遗留代码(questionnaire-error + retryLoad 移除)
- [fix] 副标题同步更新为自估591分 + 候选志愿546条数据校准
- [fix] 页脚注入版本号 v1.0.0
- [fix] 部署版 index.html: 取消家长标签,统一 filler-tianheng
- [fix] Dashboard 文案修正(4份→2份线上问卷)
- [fix] 清理冗余部署脚本(v1-v4归档至 archived_scripts/)
- [fix] 等效位次工具纳入 deploy 目录
- [chore] .gitignore 初始化
- [init] Git 仓库初始化
2026-06-24 13:11:34 +08:00

43 lines
1.4 KiB
Python

import paramiko, time
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("100.85.152.112", 22, "simon", "Nas82829330")
def run(cmd):
"""Execute SSH command and return stdout string"""
stdin, stdout, stderr = c.exec_command(cmd, timeout=10)
# Wait for command to finish
while not stdout.channel.exit_status_ready():
time.sleep(0.1)
out = stdout.read().decode("utf-8", errors="replace").strip()
err = stderr.read().decode("utf-8", errors="replace").strip()
return out, err
# Get report file list
out, err = run("ls /volume1/docker/gaokao-portal/nginx/html/reports/")
reports = [f for f in out.split("\n") if f.endswith(".html")]
# Test all pages
pages = ["/", "/report.html", "/questionnaire.html", "/results.html", "/css/style.css"]
pages += [f"/reports/{r}" for r in reports]
print("页面验证:")
for path in pages:
out, err = run(f"wget -q --spider http://localhost:8080{path} 2>&1 && echo OK || echo FAIL")
status = "OK" if "OK" in out else "FAIL"
print(f" [{status}] {path}")
# Container status
out, err = run("echo 'Nas82829330' | sudo -S /usr/local/bin/docker compose -f /volume1/docker/gaokao-portal/docker-compose.yml ps 2>/dev/null")
print("\n容器状态:")
for line in out.split("\n"):
if line.strip():
print(f" {line}")
# Count files
out, err = run("find /volume1/docker/gaokao-portal -type f | wc -l")
print(f"\n部署文件总数: {out}")
c.close()