Odin/scripts/restart-odin.ps1

35 lines
1.2 KiB
PowerShell

param(
[int] $Port = 8797,
[string] $StateDir = "E:\Projects\Odin\scratch\odin",
[string] $CultNetRudpBind = "0.0.0.0:17871",
[string] $IdunnRudpHealth = "127.0.0.1:17870",
[string] $IdunnDaemon = "odin",
[string] $IdunnHealthContract = "odin.cultnet-rudp-provider-health"
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$stopScript = Join-Path $PSScriptRoot "stop-odin.ps1"
$startScript = Join-Path $PSScriptRoot "start-odin.ps1"
$healthScript = Join-Path $PSScriptRoot "health-odin.ps1"
$powerShellExe = Join-Path $env:WINDIR "System32\WindowsPowerShell\v1.0\powershell.exe"
if (-not (Test-Path -LiteralPath $powerShellExe)) {
throw "PowerShell executable is missing at $powerShellExe"
}
& $powerShellExe -NoProfile -ExecutionPolicy Bypass -File $stopScript -StateDir $StateDir
& $powerShellExe -NoProfile -ExecutionPolicy Bypass -File $startScript `
-Port $Port `
-StateDir $StateDir `
-CultNetRudpBind $CultNetRudpBind `
-IdunnRudpHealth $IdunnRudpHealth `
-IdunnDaemon $IdunnDaemon `
-IdunnHealthContract $IdunnHealthContract
& $powerShellExe -NoProfile -ExecutionPolicy Bypass -File $healthScript `
-Port $Port `
-StateDir $StateDir `
-CultNetRudpBind $CultNetRudpBind