Setup guide
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.
Example
We will add a task that executes the script log-test every hour:
[admin@Wandy] system script> add name=log-test source=:log message=test
[admin@Wandy] system script> print
0 name="log-test" source=":log messgae=test" owner=admin run-count=0
[admin@Wandy] system script> .. scheduler
[admin@Wandy] system scheduler> add name=run-1h interval=1h
on-event=log-test
[admin@Wandy] system scheduler> print
Flags: X - disabled
# NAME ON-EVENT START-DATE START-TIME INTERVAL RUN-COUNT
0 run-1h log-test mar/30/2004 06:11:35 1h 0
[admin@Wandy] 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@Wandy] queue simple> add name=Cust0 interface=ether1 \
\... dst-address=192.168.0.0/24 limit-at=64000
[admin@Wandy] 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@Wandy] queue simple> /system script
[admin@Wandy] system script> add name=start_limit source={/queue simple set \
\... Cust0 limit-at=64000}
[admin@Wandy] system script> add name=stop_limit source={/queue simple set \
\... Cust0 limit-at=128000}
[admin@Wandy] system script> print
0 name="start_limit" source="/queue simple set Cust0 limit-at=64000"
owner=admin run-count=0
1 name="stop_limit" source="/queue simple set Cust0 limit-at=128000"
owner=admin run-count=0
[admin@Wandy] system script> .. scheduler
[admin@Wandy] system scheduler> add interval=24h name="set-64k" \
\... start-time=9:00:00 on-event=start_limit
[admin@Wandy] system scheduler> add interval=24h name="set-128k" \
\... start-time=17:00:00 on-event=stop_limit
[admin@Wandy] system scheduler> print
Flags: X - disabled
# NAME ON-EVENT START-DATE START-TIME INTERVAL RUN-COUNT
0 set-64k start... oct/30/2008 09:00:00 1d 0
1 set-128k stop_... oct/30/2008 17:00:00 1d 0
[admin@Wandy] system scheduler>
The following example schedules a script that sends each week a backup of router configuration by
e-mail.
[admin@Wandy] system script> add name=e-backup source={/system backup
{... save name=email; /tool e-mail send to="root@host.com" subject=[/system
{... identity get name]" Backup" file=email.backup}
[admin@Wandy] system script> print
0 name="e-backup" source="/system backup save name=ema... owner=admin
run-count=0
[admin@Wandy] system script> .. scheduler