The previous commit fixed the target catalog and the operator alarm, but the actuators the catalog invokes carried the same E: paths. Idunn would have resolved every target and then failed on the first restart or deploy it ran, for exactly the reason the alarm failed. Rebased 41 references across 27 scripts: - .cmd bodies invoke their sibling .ps1 through %~dp0 instead of an absolute drive path, and restart-weksa.cmd reaches its sibling repo the same way. - .ps1 parameter defaults and assignments derive from $PSScriptRoot: one level up for paths inside Odin, two for sibling repos under the projects root. Left deliberately alone: $RemoteViliRoot and $StateRoot in restart-vili.ps1. Both are consumed inside the EncodedCommand block that restart-vili ssh's to raven, so they describe raven's filesystem, not starfire's. Whether raven also moved off E: is an operator question, not something to infer from here. Verified: all 46 scripts under scripts/ parse clean, and the derivation resolves to F:\Projects\Odin and F:\Projects on this host. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
68 lines
2.3 KiB
PowerShell
68 lines
2.3 KiB
PowerShell
param(
|
|
[string] $StateDir = (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\odin"),
|
|
[int] $MaxSilenceSeconds = 120,
|
|
[string] $CultNetRudpBind = "0.0.0.0:17871"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$pidPath = Join-Path $StateDir "odin.pid"
|
|
$outLog = Join-Path $StateDir "odin.out.log"
|
|
$errLog = Join-Path $StateDir "odin.err.log"
|
|
$cachePath = Join-Path $StateDir "odin.ccmp"
|
|
|
|
if (-not (Test-Path -LiteralPath $pidPath)) {
|
|
throw "Odin PID file is missing at $pidPath"
|
|
}
|
|
|
|
$pidText = (Get-Content -LiteralPath $pidPath -Raw).Trim()
|
|
if ($pidText -notmatch '^\d+$') {
|
|
throw "Odin PID file is invalid at ${pidPath}: '$pidText'"
|
|
}
|
|
|
|
$process = Get-CimInstance Win32_Process -Filter "ProcessId = $pidText" -ErrorAction SilentlyContinue
|
|
if ($null -eq $process) {
|
|
throw "Odin process $pidText is not running"
|
|
}
|
|
|
|
foreach ($pattern in @(
|
|
'node.exe',
|
|
'src\odin-coordinator.cjs',
|
|
"--stateDir $StateDir",
|
|
"--cultnet-rudp-bind $CultNetRudpBind",
|
|
'--idunn-daemon odin',
|
|
'--idunn-health-contract odin.cultnet-rudp-provider-health'
|
|
)) {
|
|
if ($process.CommandLine -notlike "*$pattern*") {
|
|
throw "Odin process command line is missing expected segment ${pattern}: $($process.CommandLine)"
|
|
}
|
|
}
|
|
|
|
foreach ($logPath in @($outLog, $errLog)) {
|
|
if (-not (Test-Path -LiteralPath $logPath)) {
|
|
throw "Odin log is missing at $logPath"
|
|
}
|
|
}
|
|
|
|
$newestLogWriteUtc = @($outLog, $errLog) |
|
|
ForEach-Object { (Get-Item -LiteralPath $_).LastWriteTimeUtc } |
|
|
Sort-Object -Descending |
|
|
Select-Object -First 1
|
|
$logAgeSeconds = ([DateTime]::UtcNow - $newestLogWriteUtc).TotalSeconds
|
|
if ($logAgeSeconds -gt $MaxSilenceSeconds) {
|
|
throw "Odin logs have been silent for $([math]::Round($logAgeSeconds))s, exceeding $MaxSilenceSeconds seconds"
|
|
}
|
|
|
|
if (-not (Test-Path -LiteralPath $cachePath)) {
|
|
throw "Odin CultMesh store is missing at $cachePath"
|
|
}
|
|
|
|
$rudpPort = [int](($CultNetRudpBind -split ':')[-1])
|
|
$udpListener = Get-NetUDPEndpoint -LocalPort $rudpPort -ErrorAction SilentlyContinue |
|
|
Where-Object { $_.OwningProcess -eq [int]$pidText } |
|
|
Select-Object -First 1
|
|
if ($null -eq $udpListener) {
|
|
throw "Odin is not listening on UDP port $rudpPort as process $pidText"
|
|
}
|
|
|
|
Write-Host "Odin healthy: pid=$pidText cultmesh_rudp_udp=$rudpPort store=$cachePath log_age=$([math]::Round($logAgeSeconds))s"
|