aboutsummaryrefslogtreecommitdiffstats
path: root/mode-button-event
diff options
context:
space:
mode:
Diffstat (limited to 'mode-button-event')
-rw-r--r--mode-button-event14
1 files changed, 14 insertions, 0 deletions
diff --git a/mode-button-event b/mode-button-event
new file mode 100644
index 0000000..2306e1e
--- /dev/null
+++ b/mode-button-event
@@ -0,0 +1,14 @@
+#
+# RouterOS script: mode-button-event
+# Copyright (c) 2018 Christian Hesse <mail@eworm.de>
+#
+# run on mode-button event and count button presses
+
+:global "mode-button";
+
+:set ($"mode-button"->"count") ($"mode-button"->"count" + 1);
+
+:if ([ :len [ / system scheduler find where name="mode-button-scheduler" ] ] = 0) do={
+ :log info "Creating mode-button scheduler...";
+ / system scheduler add name=mode-button-scheduler on-event=mode-button-scheduler interval=5s;
+}