mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: $ScriptLock: allow to return...
... with true instead of breaking with error.
This commit is contained in:
parent
89f8dc7120
commit
301ad4b3e5
1 changed files with 8 additions and 3 deletions
|
@ -904,13 +904,18 @@
|
||||||
|
|
||||||
# lock script against multiple invocation
|
# lock script against multiple invocation
|
||||||
:set ScriptLock do={
|
:set ScriptLock do={
|
||||||
|
:local Script [ :tostr $1 ];
|
||||||
|
:local DoReturn $2;
|
||||||
|
|
||||||
|
:global IfThenElse;
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
|
|
||||||
:local Script [ :tostr $1 ];
|
|
||||||
|
|
||||||
:if ([ :len [ / system script job find where script=$Script ] ] > 1) do={
|
:if ([ :len [ / system script job find where script=$Script ] ] > 1) do={
|
||||||
$LogPrintExit2 info $0 ("Script " . $Script . " started more than once... Aborting.") true;
|
$LogPrintExit2 info $0 ("Script " . $Script . " started more than once... Aborting.") \
|
||||||
|
[ $IfThenElse ($DoReturn = true) false true ];
|
||||||
|
:return true;
|
||||||
}
|
}
|
||||||
|
:return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
# send notification via e-mail - expects at lease two string arguments
|
# send notification via e-mail - expects at lease two string arguments
|
||||||
|
|
Loading…
Reference in a new issue