diff options
author | Christian Hesse <mail@eworm.de> | 2024-03-06 23:53:50 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2024-03-12 15:27:15 +0100 |
commit | 6fd39bd3c5d7c3fe5dca9e92275f60e0b3217f03 (patch) | |
tree | 7ced2fbdb536447b537a967e945600ba6dd78c8a /check-routeros-update.rsc | |
parent | b86d6314868596dacdf422db80ef0ff27c61c644 (diff) | |
parent | f0856c264e07804a229668268a457f2154cb373a (diff) |
Merge branch 'do-with-on-error' into nextrouteros-7.15beta4-2
Diffstat (limited to 'check-routeros-update.rsc')
-rw-r--r-- | check-routeros-update.rsc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/check-routeros-update.rsc b/check-routeros-update.rsc index ae0038c..a68762b 100644 --- a/check-routeros-update.rsc +++ b/check-routeros-update.rsc @@ -11,8 +11,8 @@ :global GlobalFunctionsReady; :while ($GlobalFunctionsReady != true) do={ :delay 500ms; } -:local Main do={ - :local ScriptName [ :tostr $1 ]; +:do { + :local ScriptName [ :jobname ]; :global Identity; :global SafeUpdateAll; @@ -42,7 +42,7 @@ } :if ([ $ScriptLock $ScriptName ] = false) do={ - :return false; + :error false; } $WaitFullyConnected; @@ -56,7 +56,7 @@ :if ([ $ScriptFromTerminal $ScriptName ] = true && ($Update->"installed-version") = ($Update->"latest-version")) do={ $LogPrintExit2 info $ScriptName ("System is already up to date.") false; - :return true; + :error true; } :local NumInstalled [ $VersionToNum ($Update->"installed-version") ]; @@ -133,7 +133,7 @@ :if ($SentRouterosUpdateNotification = $Update->"latest-version") do={ $LogPrintExit2 info $ScriptName ("Already sent the RouterOS update notification for version " . \ $Update->"latest-version" . ".") false; - :return true; + :error true; } $SendNotification2 ({ origin=$ScriptName; \ @@ -148,7 +148,7 @@ :if ($SentRouterosUpdateNotification = $Update->"latest-version") do={ $LogPrintExit2 info $ScriptName ("Already sent the RouterOS downgrade notification for version " . \ $Update->"latest-version" . ".") false; - :return true; + :error true; } $SendNotification2 ({ origin=$ScriptName; \ @@ -160,6 +160,4 @@ " is available for downgrade.") false; :set SentRouterosUpdateNotification ($Update->"latest-version"); } -} - -$Main [ :jobname ]; +} on-error={ } |