aboutsummaryrefslogtreecommitdiffstats
path: root/hello-world.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-01-09 17:56:26 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-01-10 21:10:51 +0100
commitfa5291f6d1d0ab748221f2d72ae819ae874d2093 (patch)
tree15180226a46621c3330774020cbce61561386d9d /hello-world.rsc
downloadrouteros-scripts-custom-fa5291f6d1d0ab748221f2d72ae819ae874d2093.tar.gz
routeros-scripts-custom-fa5291f6d1d0ab748221f2d72ae819ae874d2093.tar.zst
initial commit
Diffstat (limited to 'hello-world.rsc')
-rw-r--r--hello-world.rsc21
1 files changed, 21 insertions, 0 deletions
diff --git a/hello-world.rsc b/hello-world.rsc
new file mode 100644
index 0000000..f3a3436
--- /dev/null
+++ b/hello-world.rsc
@@ -0,0 +1,21 @@
+#!rsc by RouterOS
+# RouterOS script: hello-world.rsc
+# Copyright (c) 2023 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.rsc";
+: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!" });
+}