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)
All checks were successful
build / build-test (push) Successful in 1m17s
All checks were successful
build / build-test (push) Successful in 1m17s
This commit is contained in:
parent
ead4c721d4
commit
39cbc8b2de
2 changed files with 16 additions and 4 deletions
|
|
@ -3,8 +3,14 @@ $ErrorActionPreference = 'Stop'
|
||||||
Set-Location $PSScriptRoot
|
Set-Location $PSScriptRoot
|
||||||
|
|
||||||
if (-not $NoSync) {
|
if (-not $NoSync) {
|
||||||
Write-Host "Syncing my_cars.json from moria ..."
|
ssh -o ConnectTimeout=3 -o BatchMode=yes jan@192.168.1.2 "exit" 2>$null
|
||||||
scp -q jan@192.168.1.2:Development/top_drives/my_cars.json .\my_cars.json
|
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" }
|
if ($LASTEXITCODE -ne 0) { throw "my_cars.json sync failed" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
10
update.ps1
10
update.ps1
|
|
@ -3,8 +3,14 @@ $ErrorActionPreference = 'Stop'
|
||||||
Set-Location $PSScriptRoot
|
Set-Location $PSScriptRoot
|
||||||
|
|
||||||
if (-not $NoSync) {
|
if (-not $NoSync) {
|
||||||
Write-Host "Syncing my_cars.json from moria ..."
|
ssh -o ConnectTimeout=3 -o BatchMode=yes jan@192.168.1.2 "exit" 2>$null
|
||||||
scp -q jan@192.168.1.2:Development/top_drives/my_cars.json .\my_cars.json
|
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" }
|
if ($LASTEXITCODE -ne 0) { throw "my_cars.json sync failed" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue