From 75318209e2fa44763769f9342b3945f93b5d6934 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Tue, 20 Feb 2018 17:06:09 +0100 Subject: [PATCH] Send an email before terminating upon an error. Refers to #18, #28 --- Updater/Update-Service.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Updater/Update-Service.ps1 b/Updater/Update-Service.ps1 index 35e3449..ea63423 100644 --- a/Updater/Update-Service.ps1 +++ b/Updater/Update-Service.ps1 @@ -614,7 +614,9 @@ Write-Verbose "Required update action items:`n> - $($UpdItems -join "`n> - ")`n" if ($ConfigShouldBeUpdated) { $ConfigUpdated = Update-Configuration if (-Not $ConfigUpdated) { - Log-Error "Updating the configuration failed, $($Me) terminating!" + $msg = "Updating the configuration failed, $($Me) terminating!" + Log-Error $msg + Send-MailReport -Subject "updated failed!" -Body $msg Exit } } @@ -622,7 +624,9 @@ if ($ConfigShouldBeUpdated) { if ($ServiceShouldBeUpdated) { $ServiceUpdated = Update-ServiceBinaries if (-Not $ServiceUpdated) { - Log-Error "Updating the service binaries failed, $($Me) terminating!" + $msg = "Updating the service binaries failed, $($Me) terminating!" + Log-Error $msg + Send-MailReport -Subject "updated failed!" -Body $msg Exit } } -- GitLab