add scripts mode-button-{event,scheduler}

This commit is contained in:
Christian Hesse 2018-09-10 22:15:54 +02:00
parent 8f4986af0b
commit 172d789f2a
3 changed files with 38 additions and 0 deletions

14
mode-button-event Normal file
View file

@ -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;
}