diff options
author | Christian Hesse <mail@eworm.de> | 2018-08-30 08:18:17 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2018-08-30 11:14:01 +0200 |
commit | 23b167e84bc918f35d9d39f699b3952b5d7f8581 (patch) | |
tree | 44a6fc0af86fbf4df7db28fec9f412d9c4fb9010 | |
parent | 21f2b04f9a7870d92aff22963a74da1758b7e43d (diff) |
check-routeros-update: resend notification if version changes
-rw-r--r-- | check-routeros-update | 20 | ||||
-rw-r--r-- | global-config | 2 |
2 files changed, 10 insertions, 12 deletions
diff --git a/check-routeros-update b/check-routeros-update index 2ff810c..bcbe742 100644 --- a/check-routeros-update +++ b/check-routeros-update @@ -16,21 +16,19 @@ } } -:if ($"sent-routeros-update-notification" = true) do={ - :error "Already sent the RouterOS update notification."; -} - -# get some information -:local model [ / system routerboard get model ]; -:local serialnumber [ / system routerboard get serial-number ]; - -# check for RouterOS / system package update check-for-updates without-paging; :local installedversion [ / system package update get installed-version ]; :local latestversion [ / system package update get latest-version ]; -:local channel [ / system package update get channel ]; + +:if ($"sent-routeros-update-notification" = $latestversion) do={ + :error ("Already sent the RouterOS update notification for version" . $latestversion . "."); +} :if ($installedversion != $latestversion) do={ + :local channel [ / system package update get channel ]; + :local model [ / system routerboard get model ]; + :local serialnumber [ / system routerboard get serial-number ]; + / tool e-mail send to=$"email-general-to" cc=$"email-general-cc" \ subject=("[" . $identity . "] RouterOS update notification") \ body=("There is a RouterOS update available\n\n" . \ @@ -40,5 +38,5 @@ "Channel: " . $channel . "\n" . \ "Installed: " . $installedversion . "\n" . \ "Available: " . $latestversion); - :set "sent-routeros-update-notification" true; + :set "sent-routeros-update-notification" $latestversion; } diff --git a/global-config b/global-config index 3b24e0f..756251b 100644 --- a/global-config +++ b/global-config @@ -50,5 +50,5 @@ :global "script-updates-ignore" { "global-config"; "GeneratePSK" }; # Do *NOT* change these! -:global "sent-routeros-update-notification" false; +:global "sent-routeros-update-notification" "-"; :global "identity" [ / system identity get name ]; |