mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-01-21 16:39:32 +00:00
check-health: early exit with :exit
This commit is contained in:
parent
d8980ffc11
commit
9f7ec88f3d
1 changed files with 3 additions and 6 deletions
|
|
@ -8,7 +8,6 @@
|
||||||
# check for RouterOS health state
|
# check for RouterOS health state
|
||||||
# https://rsc.eworm.de/doc/check-health.md
|
# https://rsc.eworm.de/doc/check-health.md
|
||||||
|
|
||||||
:local ExitOK false;
|
|
||||||
:onerror Err {
|
:onerror Err {
|
||||||
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
||||||
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
||||||
|
|
@ -37,8 +36,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:local Resource [ /system/resource/get ];
|
:local Resource [ /system/resource/get ];
|
||||||
|
|
@ -77,8 +75,7 @@
|
||||||
:local Plugins [ /system/script/find where name~"^check-health\\.d/." ];
|
:local Plugins [ /system/script/find where name~"^check-health\\.d/." ];
|
||||||
:if ([ :len $Plugins ] = 0) do={
|
:if ([ :len $Plugins ] = 0) do={
|
||||||
$LogPrint debug $ScriptName ("No plugins installed.");
|
$LogPrint debug $ScriptName ("No plugins installed.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:global CheckHealthPlugins ({});
|
:global CheckHealthPlugins ({});
|
||||||
|
|
@ -106,5 +103,5 @@
|
||||||
|
|
||||||
:set CheckHealthPlugins;
|
:set CheckHealthPlugins;
|
||||||
} do={
|
} do={
|
||||||
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
|
:global ExitError; $ExitError false [ :jobname ] $Err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue