aboutsummaryrefslogtreecommitdiffstats
path: root/hello-world.rsc
blob: 1fbe6b470e6aec6276d0dae56f99ef2ec4adf36d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!rsc by RouterOS
# RouterOS script: hello-world
# Copyright (c) 2023-2024 Christian Hesse <mail@eworm.de>
# 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

:local 0 "hello-world";
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }

:global LogPrintExit2;
:global ScriptFromTerminal;
:global SendNotification2;

:if ([ $ScriptFromTerminal $0 ] = true) do={
  $LogPrintExit2 info $0 ("Hello world!") false;
} else={
  $SendNotification2 ({ origin=$0; subject="Hello..."; message="... world!" });
}