16 lines
633 B
PowerShell
16 lines
633 B
PowerShell
# PM2 重启脚本 (Windows PowerShell)
|
|
# 用法: .\pm2-restart.ps1
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
if (-not (Get-Command pm2 -ErrorAction SilentlyContinue)) {
|
|
Write-Host "[错误] 未找到 pm2" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
pm2 restart api-key-manager
|
|
Write-Host "已重启 api-key-manager" -ForegroundColor Green
|
|
$lan = (Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue | Where-Object { $_.IPAddress -notmatch '^127\.' } | Select-Object -First 1).IPAddress
|
|
Write-Host "本机: http://127.0.0.1:5200" -ForegroundColor Cyan
|
|
if ($lan) { Write-Host "局域网: http://${lan}:5200" -ForegroundColor Cyan }
|