Files
inquiry_robot/deploy/_remote_nginx_reload.ps1
T

27 lines
797 B
PowerShell

$ErrorActionPreference = "Continue"
$Nginx = "C:\nginx-1.18.0"
$AiNew = "C:\Users\ytd_extdev_0903\incoming\ai.conf.cutover-8910"
$Ai = Join-Path $Nginx "myconf\ai.conf"
Copy-Item $AiNew $Ai -Force
Write-Output "conf copied"
# Prefer Windows service restart (runs as SYSTEM, can reload)
try {
Restart-Service -Name "Nginx1.18" -Force -ErrorAction Stop
Write-Output "SERVICE_RESTARTED"
} catch {
Write-Output "SERVICE_RESTART_FAIL=$_"
try {
& "C:\yutongda\bounce_nginx.ps1"
Write-Output "BOUNCE_RAN"
} catch {
Write-Output "BOUNCE_FAIL=$_"
}
}
Start-Sleep -Seconds 2
cmd /c "curl.exe -sk -H `"Host: ai.ytd-scm.com`" https://127.0.0.1/agent/health"
Write-Output ""
cmd /c "curl.exe -sk -o NUL -w %%{http_code} -H `"Host: ai.ytd-scm.com`" https://127.0.0.1/"
Write-Output ""