From ba4a32581a06360b397761cb3f682607efc1acf2 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Thu, 25 Apr 2019 14:48:20 +0200 Subject: [PATCH] Development convenience script to automatically trigger the updater --- Scripts/Trigger-Updater.ps1 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Scripts/Trigger-Updater.ps1 diff --git a/Scripts/Trigger-Updater.ps1 b/Scripts/Trigger-Updater.ps1 new file mode 100644 index 0000000..5d0cac6 --- /dev/null +++ b/Scripts/Trigger-Updater.ps1 @@ -0,0 +1,35 @@ +# Helper script to trigger the updater if the corresponding marker file has +# been removed (e.g. by using the `Deploy-NewBuild.ps1` script). + +#Requires -RunAsAdministrator + +[CmdletBinding()] +Param( + [String] $UpdaterSettings = "C:\Tools\AutoTx-Updater\UpdaterConfig.inc.ps1" +) + +$ErrorActionPreference = "Stop" + +try { + . $UpdaterSettings +} +catch { + $ex = $_.Exception.Message + Write-Host "Error reading settings file: '$($UpdaterSettings)' [$($ex)]" + Exit +} + +$Marker = "$($UpdateSourcePath)\Service\UpdateMarkers\$($env:COMPUTERNAME)" +Write-Host "Using marker file $Marker" + +while ($true) { + if (Test-Path $Marker) { + # Write-Host "marker file found" + } else { + # Write-Host "NO marker file found, starting updater..." + (Get-ScheduledJob -Name "AutoTx-Updater").StartJob() + # Allow the updater to complete its run: + Start-Sleep 30 + } + Start-Sleep 1 +} \ No newline at end of file -- GitLab