24.11.2014 Views

General Information

General Information

General Information

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

In the example below monitor action will execute given script each time it prints stats on the<br />

screen, and it will assign all printed values to local variables with the same name:<br />

[admin@MikroTik] interface> monitor-traffic ether2 once do={:environment print}<br />

received-packets-per-second: 0<br />

received-bits-per-second: 0bps<br />

sent-packets-per-second: 0<br />

sent-bits-per-second: 0bps<br />

Global Variables<br />

i=1<br />

Local Variables<br />

sent-bits-per-second=0<br />

received-packets-per-second=0<br />

received-bits-per-second=0<br />

sent-packets-per-second=0<br />

[admin@MikroTik] interface><br />

Additional Features<br />

Description<br />

It is possible to include comments in console scripts. If script line starts with '#', all characters until<br />

new line are ignored.<br />

It is possible to put multiple commands on a single line, separating them by ';'. Console treats ';' as<br />

end of line when separating script text into commands.<br />

If you want to use any of {}[]"'\$ characters in a string, you have to prefix them with '\' character.<br />

Console takes any character following '\' literally, without assigning any special meaning to it,<br />

except for such cases:<br />

\a bell (alarm), character code 7<br />

\b backspace, character code 8<br />

\f form feed, character code 12<br />

\n newline, character code 10<br />

\r carriage return, character code 13<br />

\t tabulation, character code 9<br />

\v vertical tabulation, character code 11<br />

\_ space, character code 32<br />

Note that '\', followed by any amount of whitespace characters (spaces, newlines, carriage returns,<br />

tabulations), followed by newline is treated as a single whitespace, except inside quotes, where it is<br />

treated as nothing. This is used by console to break up long lines in scripts generated by export<br />

commands.<br />

Scripts<br />

Home menu level: /system script<br />

Description<br />

In RouterOS, a script may be started in three different ways:<br />

• according to a specific time or an interval of time<br />

• on an event - for example, if the netwatch tool sees that an address does not respond to pings<br />

• by another script<br />

Page 532 of 568<br />

Copyright 1999-2005, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA.<br />

Other trademarks and registred trademarks mentioned herein are properties of their respective owners.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!