mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-01-21 00:19:32 +00:00
log-forward: early exit with :exit
This commit is contained in:
parent
f94ae82e3e
commit
394c204a4d
1 changed files with 3 additions and 6 deletions
|
|
@ -8,7 +8,6 @@
|
||||||
# forward log messages via notification
|
# forward log messages via notification
|
||||||
# https://rsc.eworm.de/doc/log-forward.md
|
# https://rsc.eworm.de/doc/log-forward.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) \
|
||||||
|
|
@ -33,8 +32,7 @@
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :typeof $LogForwardLast ] = "nothing") do={
|
:if ([ :typeof $LogForwardLast ] = "nothing") do={
|
||||||
|
|
@ -48,8 +46,7 @@
|
||||||
:if ($LogForwardRateLimit > 30) do={
|
:if ($LogForwardRateLimit > 30) do={
|
||||||
:set LogForwardRateLimit ($LogForwardRateLimit - 1);
|
:set LogForwardRateLimit ($LogForwardRateLimit - 1);
|
||||||
$LogPrint info $ScriptName ("Rate limit in action, not forwarding logs, if any!");
|
$LogPrint info $ScriptName ("Rate limit in action, not forwarding logs, if any!");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:local Count 0;
|
:local Count 0;
|
||||||
|
|
@ -111,5 +108,5 @@
|
||||||
|
|
||||||
:set LogForwardLast $Max;
|
:set LogForwardLast $Max;
|
||||||
} 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