Files
inquiry_robot/deploy/_remote_finish_admin_cutover.ps1
T

37 lines
1.5 KiB
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.
# 远端:确认 8180/8910/8080,然后执行 admin cutover(依赖已上传的 admin-dist.zip)
$ErrorActionPreference = 'Continue'
function Port-Up([int]$p) {
return [bool](Get-NetTCPConnection -LocalPort $p -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1)
}
Write-Output ("8180=" + (Port-Up 8180))
Write-Output ("8910=" + (Port-Up 8910))
Write-Output ("8080=" + (Port-Up 8080))
Write-Output ("zip=" + (Test-Path 'C:\Users\ytd_extdev_0903\incoming\admin-dist.zip'))
Write-Output ("conf=" + (Test-Path 'C:\Users\ytd_extdev_0903\incoming\ai.conf.cutover-8180'))
if (-not (Port-Up 8180)) {
Write-Output 'START_LEDGER'
& powershell -NoProfile -ExecutionPolicy Bypass -File 'C:\Users\ytd_extdev_0903\incoming\_remote_wmi_start_ledger.ps1'
}
if (-not (Port-Up 8910)) {
Write-Output 'START_AGENT'
& powershell -NoProfile -ExecutionPolicy Bypass -File 'C:\Users\ytd_extdev_0903\incoming\_remote_safe_deploy_agent.ps1'
}
# 再等一会儿 8180
for ($i = 0; $i -lt 24; $i++) {
if (Port-Up 8180) { break }
Start-Sleep -Seconds 5
}
Write-Output ("8180_final=" + (Port-Up 8180))
Write-Output ("8910_final=" + (Port-Up 8910))
Write-Output ("8080_final=" + (Port-Up 8080))
if (-not (Port-Up 8180)) { throw '8180 still down' }
if (-not (Port-Up 8910)) { throw '8910 still down' }
if (-not (Port-Up 8080)) { throw '8080 still down' }
$ErrorActionPreference = 'Stop'
& powershell -NoProfile -ExecutionPolicy Bypass -File 'C:\Users\ytd_extdev_0903\incoming\_remote_cutover_admin_8180.ps1'
Write-Output 'ALL_DONE'