From 39cbc8b2dee802c24282b758ac420e6913e42aa1 Mon Sep 17 00:00:00 2001 From: Jan-Peter von Hunnius Date: Mon, 31 Aug 2026 07:28:57 +0200 Subject: [PATCH] PS scripts: my_cars.json sync falls back to hunnius.net when moria is unreachable (travel mode; hunnius receives the file hourly from the moria sync cron) --- full_script.ps1 | 10 ++++++++-- update.ps1 | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/full_script.ps1 b/full_script.ps1 index a73dbbd..088ca06 100644 --- a/full_script.ps1 +++ b/full_script.ps1 @@ -3,8 +3,14 @@ $ErrorActionPreference = 'Stop' Set-Location $PSScriptRoot if (-not $NoSync) { - Write-Host "Syncing my_cars.json from moria ..." - scp -q jan@192.168.1.2:Development/top_drives/my_cars.json .\my_cars.json + ssh -o ConnectTimeout=3 -o BatchMode=yes jan@192.168.1.2 "exit" 2>$null + if ($LASTEXITCODE -eq 0) { + Write-Host "Syncing my_cars.json from moria (LAN) ..." + scp -q jan@192.168.1.2:Development/top_drives/my_cars.json .\my_cars.json + } else { + Write-Host "moria unreachable - syncing my_cars.json from hunnius.net (remote) ..." + scp -q jan@hunnius.net:Development/top_drives/my_cars.json .\my_cars.json + } if ($LASTEXITCODE -ne 0) { throw "my_cars.json sync failed" } } diff --git a/update.ps1 b/update.ps1 index bbd3c9c..caceded 100644 --- a/update.ps1 +++ b/update.ps1 @@ -3,8 +3,14 @@ $ErrorActionPreference = 'Stop' Set-Location $PSScriptRoot if (-not $NoSync) { - Write-Host "Syncing my_cars.json from moria ..." - scp -q jan@192.168.1.2:Development/top_drives/my_cars.json .\my_cars.json + ssh -o ConnectTimeout=3 -o BatchMode=yes jan@192.168.1.2 "exit" 2>$null + if ($LASTEXITCODE -eq 0) { + Write-Host "Syncing my_cars.json from moria (LAN) ..." + scp -q jan@192.168.1.2:Development/top_drives/my_cars.json .\my_cars.json + } else { + Write-Host "moria unreachable - syncing my_cars.json from hunnius.net (remote) ..." + scp -q jan@hunnius.net:Development/top_drives/my_cars.json .\my_cars.json + } if ($LASTEXITCODE -ne 0) { throw "my_cars.json sync failed" } }