24.11.2014 Views

General Information

General Information

General Information

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

In the following example we will add a new sigwatch item that monitors whether the port serial1<br />

has cts signal.<br />

[admin@10.179] tool sigwatch> pr<br />

Flags: X - disabled<br />

# NAME PORT SIGNAL ON-CONDITION LOG<br />

0 test serial1 cts change no<br />

[admin@MikroTik] tool sigwatch><br />

By typing a command print detail interval=1s, we can check whether a cable is connected or it is<br />

not. See the state argument - if the cable is connected to the serial port, it shows on, otherwise it<br />

will be off.<br />

[admin@MikroTik] tool sigwatch> print detail<br />

Flags: X - disabled<br />

0 name="test" port=serial1 signal=cts on-condition=change log=no script=""<br />

count=1 state=on<br />

[admin@MikroTik] tool sigwatch> print detail<br />

Flags: X - disabled<br />

0 name="test" port=serial1 signal=cts on-condition=change log=no script=""<br />

count=1 state=on<br />

[admin@MikroTik] tool sigwatch> print detail<br />

Flags: X - disabled<br />

0 name="test" port=serial1 signal=cts on-condition=change log=no script=""<br />

count=2 state=off<br />

[admin@MikroTik] tool sigwatch> print detail<br />

Flags: X - disabled<br />

0 name="test" port=serial1 signal=cts on-condition=change log=no script=""<br />

count=2 state=off<br />

[admin@MikroTik] tool sigwatch><br />

In the port menu you can see what signal is used by serial cable. For example, without any cables it<br />

looks like this:<br />

[admin@MikroTik] port> print stats<br />

0 name="serial0" line-state=dtr,rts<br />

1 name="serial1" line-state=dtr,rts<br />

[admin@MikroTik] port><br />

But after adding a serial cable to the serial port:<br />

[admin@MikroTik] port> print stats<br />

0 name="serial0" line-state=dtr,rts<br />

1 name="serial1" line-state=dtr,rts,cts<br />

[admin@MikroTik] port><br />

This means that the line-state besides the dtr and rts signals has also cts when a serial cable is<br />

connected.<br />

The example below will execute a script whenever on-condition changes to off:<br />

[admin@10.MikroTik] tool sigwatch> pr detail<br />

Flags: X - disabled<br />

0 name="cts_rest" port=serial1 signal=cts on-condition=off log=no<br />

script=/system shutdown count=0 state=on<br />

[admin@10.MikroTik] tool sigwatch><br />

It means that if a serial cable is connected to the serial port, all works fine, but as soon as it is<br />

disconnected, the router shuts down. It will continue all the time until the serial cable will not be<br />

connected again.<br />

Page 542 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!