From 9f7ec88f3ddb69141fe31ca1275bd12bb0feadac Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 19 Jan 2026 15:06:07 +0100 Subject: [PATCH] check-health: early exit with :exit --- check-health.rsc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/check-health.rsc b/check-health.rsc index 51438966..793afd3a 100644 --- a/check-health.rsc +++ b/check-health.rsc @@ -8,7 +8,6 @@ # check for RouterOS health state # https://rsc.eworm.de/doc/check-health.md -:local ExitOK false; :onerror Err { :global GlobalConfigReady; :global GlobalFunctionsReady; :retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \ @@ -37,8 +36,7 @@ } :if ([ $ScriptLock $ScriptName ] = false) do={ - :set ExitOK true; - :error false; + :exit; } :local Resource [ /system/resource/get ]; @@ -77,8 +75,7 @@ :local Plugins [ /system/script/find where name~"^check-health\\.d/." ]; :if ([ :len $Plugins ] = 0) do={ $LogPrint debug $ScriptName ("No plugins installed."); - :set ExitOK true; - :error true; + :exit; } :global CheckHealthPlugins ({}); @@ -106,5 +103,5 @@ :set CheckHealthPlugins; } do={ - :global ExitError; $ExitError $ExitOK [ :jobname ] $Err; + :global ExitError; $ExitError false [ :jobname ] $Err; }