enet-validator/scripts/session/probe_loop2.ps1

21 lines
1022 B
PowerShell
Raw Permalink Normal View History

[Console]::OutputEncoding = [Text.Encoding]::UTF8
$exe = "C:\Users\tonycao\work\light\enet-validator\target\release\enet-validator.exe"
$log = "$env:TEMP\opencode\probe_loop2.log"
Remove-Item $log -ErrorAction SilentlyContinue
for ($i = 0; $i -lt 45; $i++) {
$ts = Get-Date -Format "HH:mm:ss"
$env:HOSTDEMO_MODE = "claimonly"
$out = & $exe hostdemo 192.168.123.1 0 2>&1 | Out-String
Add-Content -Encoding utf8 $log ("=== " + $ts + " attempt " + $i + " ===`n" + $out)
if ($out -match "CLAIM_PROBE.*PASS") {
Add-Content -Encoding utf8 $log ((Get-Date -Format "HH:mm:ss") + " CLAIM UNLOCKED - full hostdemo starting (RDM discovery + 60s DMX)")
Remove-Item Env:\HOSTDEMO_MODE -ErrorAction SilentlyContinue
$out2 = & $exe hostdemo 192.168.123.1 60 2>&1 | Out-String
Add-Content -Encoding utf8 $log $out2
Add-Content -Encoding utf8 $log "=== full hostdemo done ==="
break
}
Start-Sleep -Seconds 240
}
Add-Content -Encoding utf8 $log "probe loop2 exit"