# rig45_up.ps1 -- 2-node loopback MP rig for Gitea #45 (scoreboard replication). # Launches two Release nodes + the console relay, pins them to disjoint cores # (the task #50 TCP-batching artifact), and records ONLY the PIDs it spawned so # teardown can kill exactly those and nothing else. Never kills by name. $ErrorActionPreference = 'Continue' $repo = 'C:\git\bt411' $content = Join-Path $repo 'content' $exe = Join-Path $repo 'build\Release\btl4.exe' $scratch = 'C:\Users\EPILECTRIK\AppData\Local\Temp\claude\C--git-bt411\89ab96e9-6cf0-4555-939d-05bf3708745a\scratchpad' $pidfile = Join-Path $scratch 'rig45_pids.txt' if (-not (Test-Path $exe)) { throw "no exe at $exe" } # Guard: refuse to run if any btl4 is already up -- that would be someone else's. $pre = @(Get-Process -Name btl4 -ErrorAction SilentlyContinue) if ($pre.Count -gt 0) { "ABORT: btl4 already running (pids: $($pre.Id -join ',')) -- not mine, refusing to start" exit 1 } Push-Location $content Remove-Item fa.log, fb.log, console.log, console.err -ErrorAction SilentlyContinue # Stamp the start so I can pick out only the matchlogs this run produces. $stamp = Get-Date Set-Content -Path (Join-Path $scratch 'rig45_t0.txt') -Value $stamp.ToString('o') # Shared env: the cross-pod damage hook drives the kill without a human on a # boresight; the score/death logs give the per-node narrative. $env:BT_MP_FORCE_DMG = '1' $env:BT_SCORE_LOG = '1' $env:BT_DEATH_LOG = '1' $env:BT_MP_LOG = '1' $env:BT_START_INSIDE = '1' $env:BT_DEV_GAUGES = '1' $env:BT_MATCHLOG = '1' $env:BT_LOG = 'fb.log'; $env:BT_SPAWN_AT = '40 -150' $b = Start-Process -FilePath $exe -ArgumentList '-egg','FOGDAY.EGG','-net','1601' ` -WorkingDirectory $content -PassThru Start-Sleep -Seconds 2 $env:BT_LOG = 'fa.log'; $env:BT_SPAWN_AT = '-40 -150' $a = Start-Process -FilePath $exe -ArgumentList '-egg','FOGDAY.EGG','-net','1501' ` -WorkingDirectory $content -PassThru Start-Sleep -Seconds 3 try { $b.ProcessorAffinity = [IntPtr]0x00F; $a.ProcessorAffinity = [IntPtr]0x3C0; $pinned = 'yes' } catch { $pinned = "failed: $($_.Exception.Message)" } Start-Sleep -Seconds 6 $c = Start-Process -FilePath 'python' ` -ArgumentList '-u', (Join-Path $repo 'tools\btconsole.py'), 'FOGDAY.EGG', '127.0.0.1:1501', '127.0.0.1:1601' ` -WorkingDirectory $content -PassThru ` -RedirectStandardOutput (Join-Path $content 'console.log') ` -RedirectStandardError (Join-Path $content 'console.err') Set-Content -Path $pidfile -Value @($a.Id, $b.Id, $c.Id) Pop-Location "node_a(1501)=$($a.Id) node_b(1601)=$($b.Id) console=$($c.Id) pinned=$pinned" "pids recorded in $pidfile"