flnxi-Wu/scripts/tools/check-server-status.ps1
WuYongJie f646b71813
Some checks failed
CI Check / check (push) Has been cancelled
chore: 初始化本地仓库并同步最近改动
2025-11-18 17:50:16 +08:00

20 lines
874 B
PowerShell
Raw 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.

# 快速检查服务器状态
param(
[string]$Server = "45.249.208.118",
[string]$Username = "root",
[string]$Password = "lxvhNYFZ4160"
)
$plinkPath = "C:\Program Files\PuTTY\plink.exe"
$hostKey = "SHA256:WZOtvC/+IWw29P8vyovSabmIRFkQ/Bnmhj+qhTshA4Q"
Write-Host "检查容器状态..." -ForegroundColor Cyan
& $plinkPath -batch -ssh -hostkey $hostKey -pw $Password "${Username}@${Server}" "cd /root/deploy && docker compose ps"
Write-Host "`n检查应用日志(最后30行)..." -ForegroundColor Cyan
& $plinkPath -batch -ssh -hostkey $hostKey -pw $Password "${Username}@${Server}" "cd /root/deploy && docker compose logs app --tail=30"
Write-Host "`n检查健康检查端点..." -ForegroundColor Cyan
& $plinkPath -batch -ssh -hostkey $hostKey -pw $Password "${Username}@${Server}" "curl -s http://localhost:4320/api/health || echo '健康检查失败'"