Skip to content
Snippets Groups Projects
Commit 05de4d23 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Move sourcing of settings file below function defintion block.

This allows us to potentially use the logging functions.

Refers to #13
parent 56cfcfc1
No related branches found
No related tags found
No related merge requests found
......@@ -10,17 +10,6 @@ Param(
[Parameter(Mandatory=$True)][string] $UpdaterSettings
)
try {
. $UpdaterSettings
}
catch {
$ex = $_.Exception.Message
Write-Host "Error reading settings file: '$($UpdaterSettings)' [$($ex)]"
Exit
}
$Me = $MyInvocation.MyCommand -replace '.ps1'
### function definitions #####################################################
......@@ -379,6 +368,19 @@ function Log-Info([string]$Message) {
try {
. $UpdaterSettings
}
catch {
$ex = $_.Exception.Message
Write-Host "Error reading settings file: '$($UpdaterSettings)' [$($ex)]"
Exit
}
# NOTE: $MyInvocation is not available when run as ScheduledJob, so we have to
# set a shortcut for our name explicitly ourselves here:
$Me = "Update-Service"
# first check if the service is installed and running at all
Ensure-ServiceRunning $ServiceName
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment