hello-world: use :do with on-error...
(... and skip the move into function.)
This commit is contained in:
parent
92046bf0d5
commit
24a65b2131
|
@ -6,16 +6,19 @@
|
||||||
# hello-world demo script
|
# hello-world demo script
|
||||||
# https://git.eworm.de/cgit/routeros-scripts-custom/about/doc/hello-world.md
|
# https://git.eworm.de/cgit/routeros-scripts-custom/about/doc/hello-world.md
|
||||||
|
|
||||||
:local 0 "hello-world";
|
|
||||||
:global GlobalFunctionsReady;
|
:global GlobalFunctionsReady;
|
||||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||||
|
|
||||||
|
:do {
|
||||||
|
:local ScriptName [ :jobname ];
|
||||||
|
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
:global ScriptFromTerminal;
|
:global ScriptFromTerminal;
|
||||||
:global SendNotification2;
|
:global SendNotification2;
|
||||||
|
|
||||||
:if ([ $ScriptFromTerminal $0 ] = true) do={
|
:if ([ $ScriptFromTerminal $ScriptName ] = true) do={
|
||||||
$LogPrintExit2 info $0 ("Hello world!") false;
|
$LogPrintExit2 info $ScriptName ("Hello world!") false;
|
||||||
} else={
|
} else={
|
||||||
$SendNotification2 ({ origin=$0; subject="Hello..."; message="... world!" });
|
$SendNotification2 ({ origin=$ScriptName; subject="Hello..."; message="... world!" });
|
||||||
}
|
}
|
||||||
|
} on-error={ }
|
||||||
|
|
Loading…
Reference in a new issue