21 lines
951 B
PowerShell
21 lines
951 B
PowerShell
$ErrorActionPreference = "Stop"
|
|
$Root = "C:\ytd-test"
|
|
$ptr = Get-Content (Join-Path $Root "ops\active-release.json") -Raw | ConvertFrom-Json
|
|
$AgentHome = $ptr.agentHome
|
|
$venvPy = Join-Path $AgentHome ".venv\Scripts\python.exe"
|
|
$logOut = Join-Path $Root "logs\agent-http.out.log"
|
|
$logErr = Join-Path $Root "logs\agent-http.err.log"
|
|
|
|
Get-NetTCPConnection -LocalPort 8910 -ErrorAction SilentlyContinue |
|
|
Select-Object -ExpandProperty OwningProcess -Unique |
|
|
ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
|
|
Start-Sleep -Seconds 1
|
|
|
|
# Detach via cmd so process survives SSH session end
|
|
$cmd = "cd /d `"$AgentHome`" && set YTD_ENV=test&& set AGENT_HTTP_PORT=8910&& `"$venvPy`" -m agent.http_app >> `"$logOut`" 2>> `"$logErr`""
|
|
Start-Process -FilePath "cmd.exe" -ArgumentList "/c", $cmd -WindowStyle Hidden
|
|
Start-Sleep -Seconds 6
|
|
cmd /c "curl.exe -s http://127.0.0.1:8910/health"
|
|
Write-Output ""
|
|
netstat -ano | findstr ":8910"
|