初始化询价智能体新仓:同步本地工程并排除密钥与 .env。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Incoming = "C:\Users\ytd_extdev_0903\incoming\ai.conf.cutover-8910"
|
||||
$Ai = "C:\nginx-1.18.0\myconf\ai.conf"
|
||||
$Stamp = Get-Date -Format "yyyyMMdd-HHmmss"
|
||||
|
||||
if (-not (Test-Path $Incoming)) { throw "missing incoming conf" }
|
||||
Copy-Item $Ai "$Ai.bak-before-ascii-$Stamp" -Force
|
||||
|
||||
$bytes = [System.IO.File]::ReadAllBytes($Incoming)
|
||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 239 -and $bytes[1] -eq 187 -and $bytes[2] -eq 191) {
|
||||
$list = New-Object System.Collections.Generic.List[byte]
|
||||
for ($i = 3; $i -lt $bytes.Length; $i++) { [void]$list.Add($bytes[$i]) }
|
||||
$bytes = $list.ToArray()
|
||||
}
|
||||
[System.IO.File]::WriteAllBytes($Ai, $bytes)
|
||||
Write-Output "WROTE_AI_CONF_NO_BOM"
|
||||
|
||||
Set-Location "C:\nginx-1.18.0"
|
||||
& .\nginx.exe -t
|
||||
if ($LASTEXITCODE -ne 0) { throw "nginx -t failed" }
|
||||
|
||||
Get-Process nginx -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||
Start-Sleep -Seconds 1
|
||||
|
||||
$started = $false
|
||||
try {
|
||||
Start-Service Nginx1.18 -ErrorAction Stop
|
||||
Start-Sleep -Seconds 2
|
||||
if ((Get-Service Nginx1.18).Status -eq "Running") {
|
||||
$started = $true
|
||||
Write-Output "SERVICE_RUNNING"
|
||||
}
|
||||
} catch {
|
||||
Write-Output "SERVICE_FAIL"
|
||||
}
|
||||
|
||||
if (-not $started) {
|
||||
Start-Process -FilePath "C:\nginx-1.18.0\nginx.exe" -WorkingDirectory "C:\nginx-1.18.0" -WindowStyle Hidden
|
||||
Start-Sleep -Seconds 2
|
||||
if (-not (Get-Process nginx -ErrorAction SilentlyContinue)) { throw "nginx still not running" }
|
||||
Write-Output "EXE_RUNNING"
|
||||
}
|
||||
|
||||
Get-Service Nginx1.18 | Format-List Name, Status
|
||||
Get-Process nginx | Select-Object Id | Format-Table -AutoSize
|
||||
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 root:%{http_code} -H `"Host: ai.ytd-scm.com`" https://127.0.0.1/"
|
||||
Write-Output ""
|
||||
Write-Output "NGINX_FIXED"
|
||||
Reference in New Issue
Block a user