routeros-scripts-custom/hello-world.rsc

28 lines
795 B
Plaintext
Raw Normal View History

2023-01-09 16:56:26 +00:00
#!rsc by RouterOS
# 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; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
2023-01-09 16:56:26 +00:00
2024-03-12 17:01:39 +00:00
:global LogPrint;
:global ScriptFromTerminal;
:global SendNotification2;
:if ([ $ScriptFromTerminal $ScriptName ] = true) do={
2024-03-12 17:01:39 +00:00
$LogPrint info $ScriptName ("Hello world!");
} else={
$SendNotification2 ({ origin=$ScriptName; subject="Hello..."; message="... world!" });
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}