aboutsummaryrefslogtreecommitdiffstats
path: root/mode-button-event
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-09-10 22:15:54 +0200
committerGravatar Christian Hesse <mail@eworm.de>2018-09-10 22:15:54 +0200
commit172d789f2a4f350555665173f53f6cd5122cd1a7 (patch)
treefe7cd5f64346631c9f2bbc3e9ffd40c646b8faa1 /mode-button-event
parent8f4986af0bb0ecea13594b9ea2bbcfbaa6c8a7e7 (diff)
downloadrouteros-scripts-172d789f2a4f350555665173f53f6cd5122cd1a7.tar.gz
routeros-scripts-172d789f2a4f350555665173f53f6cd5122cd1a7.tar.zst
add scripts mode-button-{event,scheduler}
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;
+}