# Wiederanlauf-Probe: beendet die Distribution HART (wsl --terminate) und misst, wann Wachhalter, # Distribution und Dashboard von selbst zurueck sind. Ein laufender Paper-Runner stirbt dabei mit -- # deshalb nur ausserhalb der Handelszeit (15:30 bis 22:00 Uhr Berliner Zeit) und nur mit -Ausfuehren. # Waehrend der Messung keinen anderen wsl.exe-Aufruf absetzen: Jeder Klient weckt die Distribution # selbst und verfaelscht das Ergebnis. Die Datei ist reines ASCII (PowerShell 5.1 liest ohne BOM ANSI). # Gemessen am 2026-09-20: terminate 19:30:17, Aufgabe und Distribution Running um 19:35:06, HTTP 200 um 19:35:13. param( [string]$Name = "Trading Plattform - WSL wachhalten", [int]$MaxSekunden = 480, [switch]$Ausfuehren ) if (-not $Ausfuehren) { "Nichts getan. Diese Probe beendet die WSL-Distribution hart; ein laufender Runner stirbt mit." "Aufruf ausserhalb der Handelszeit: powershell -File wiederanlauf_probe.ps1 -Ausfuehren" exit 2 } $wsl = "$env:SystemRoot\System32\wsl.exe" function Distro { $roh = ((& $wsl -l -v) | Out-String).Replace([string][char]0, '') foreach ($zeile in ($roh -split "\r?\n")) { if ($zeile -match 'Debian\s+(\w+)') { return $Matches[1] } } return "unbekannt" } function Probe { try { $r = Invoke-WebRequest -UseBasicParsing -TimeoutSec 3 http://127.0.0.1:8144/api/gesund return "HTTP " + $r.StatusCode } catch { return "tot" } } "Vorher: Aufgabe " + (Get-ScheduledTask -TaskName $Name).State + ", Distro " + (Distro) + ", Dashboard " + (Probe) & $wsl --terminate Debian | Out-Null $start = Get-Date "terminate um " + $start.ToString("HH:mm:ss") $letzter = "" while (((Get-Date) - $start).TotalSeconds -lt $MaxSekunden) { $a = (Get-ScheduledTask -TaskName $Name).State $d = Distro $p = Probe $s = [int]((Get-Date) - $start).TotalSeconds $jetzt = "Aufgabe $a / Distro $d / Dashboard $p" if ($jetzt -ne $letzter) { "+${s}s (" + (Get-Date).ToString("HH:mm:ss") + "): $jetzt"; $letzter = $jetzt } if ($s -gt 15 -and $a -eq "Running" -and $d -eq "Running" -and $p -eq "HTTP 200") { break } Start-Sleep -Seconds 5 } "Ende der Messung um " + (Get-Date).ToString("HH:mm:ss")