2023-01-09 16:56:26 +00:00
|
|
|
#!rsc by RouterOS
|
2023-03-07 10:25:28 +00:00
|
|
|
# RouterOS script: hello-world
|
2025-01-02 22:03:07 +00:00
|
|
|
# Copyright (c) 2023-2025 Christian Hesse <mail@eworm.de>
|
2023-01-09 16:56:26 +00:00
|
|
|
# https://git.eworm.de/cgit/routeros-scripts-custom/about/COPYING.md
|
|
|
|
#
|
|
|
|
# hello-world demo script
|
|
|
|
# https://git.eworm.de/cgit/routeros-scripts-custom/about/doc/hello-world.md
|
|
|
|
|
|
|
|
:global GlobalFunctionsReady;
|
|
|
|
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
|
|
|
|
2024-12-06 14:17:57 +00:00
|
|
|
:local ExitOK false;
|
2024-03-12 16:59:37 +00:00
|
|
|
:do {
|
|
|
|
:local ScriptName [ :jobname ];
|
2023-01-09 16:56:26 +00:00
|
|
|
|
2024-03-12 17:01:39 +00:00
|
|
|
:global LogPrint;
|
2024-03-12 16:59:37 +00:00
|
|
|
:global ScriptFromTerminal;
|
|
|
|
:global SendNotification2;
|
|
|
|
|
|
|
|
:if ([ $ScriptFromTerminal $ScriptName ] = true) do={
|
2024-03-12 17:01:39 +00:00
|
|
|
$LogPrint info $ScriptName ("Hello world!");
|
2024-03-12 16:59:37 +00:00
|
|
|
} else={
|
|
|
|
$SendNotification2 ({ origin=$ScriptName; subject="Hello..."; message="... world!" });
|
|
|
|
}
|
2024-12-06 14:17:57 +00:00
|
|
|
} on-error={
|
|
|
|
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
|
|
|
}
|