MikroTik RouterOS v2.9 Reference Manual page 664

Reference manual
Table of Contents

Advertisement

interval ( time ; default: 0s ) - interval between two script executions, if time interval is set to zero,
the script is only executed at its start time, otherwise it is executed repeatedly at the time interval is
specified
name ( name ) - name of the task
on-event ( name ) - name of the script to execute. It must be presented at /system script
run-count ( read-only: integer ) - to monitor script usage, this counter is incremented each time the
script is executed
start-date ( date ) - date of the first script execution
start-time ( time ) - time of the first script execution
• startup - execute the script 3 seconds after the system startup.
Notes
Rebooting the router will reset run-count counter.
If more than one script has to be executed simultaneously, they are executed in the order they
appear in the scheduler configuration. This can be important if one scheduled script is used to
disable another one. The order of scripts can be changed with the move command.
If a more complex execution pattern is needed, it can usually be done by scheduling several scripts,
and making them enable and disable each other.
if scheduler item has start-time set to startup, it behaves as if start-time and start-date were set to
time 3 seconds after console starts up. It means that all scripts having start-time=startup and
interval=0 will be executed once each time router boots.
Example
We will add a task that executes the script log-test every hour:
[admin@MikroTik] system script> add name=log-test source=:log message=test
[admin@MikroTik] system script> print
0 name="log-test" source=":log messgae=test" owner=admin run-count=0
[admin@MikroTik] system script> .. scheduler
[admin@MikroTik] system scheduler> add name=run-1h interval=1h
on-event=log-test
[admin@MikroTik] system scheduler> print
Flags: X - disabled
#
NAME
ON-EVENT
0
run-1h
log-test
[admin@MikroTik] system scheduler>
In another example there will be two scripts added that will change the bandwidth setting of a queue
rule "Cust0". Every day at 9AM the queue will be set to 64Kb/s and at 5PM the queue will be set to
128Kb/s. The queue rule, the scripts, and the scheduler tasks are below:
[admin@MikroTik] queue simple> add name=Cust0 interface=ether1 \
\... dst-address=192.168.0.0/24 limit-at=64000
[admin@MikroTik] queue simple> print
Flags: X - disabled, I - invalid
0
name="Cust0" target-address=0.0.0.0/0 dst-address=192.168.0.0/24
interface=ether1 limit-at=64000 queue=default priority=8 bounded=yes
[admin@MikroTik] queue simple> /system script
[admin@MikroTik] system script> add name=start_limit source={/queue simple set \
\... Cust0 limit-at=64000}
Page 650 of 695
Copyright 1999-2007, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA.
Other trademarks and registred trademarks mentioned herein are properties of their respective owners.
START-DATE
START-TIME INTERVAL
mar/30/2004 06:11:35
RUN-COUNT
1h
0

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents