Setup guide
Notes
You can type actual script source instead of the script name from /system script list.
Example
In the following example we will add a new sigwatch item that monitors whether the port serial1
has cts signal.
[admin@10.179] tool sigwatch> pr
Flags: X - disabled
# NAME PORT SIGNAL ON-CONDITION LOG
0 test serial1 cts change no
[admin@Wandy] tool sigwatch>
By typing a command print detail interval=1s, we can check whether a cable is connected or it is
not. See the state argument - if the cable is connected to the serial port, it shows on, otherwise it
will be off.
[admin@Wandy] tool sigwatch> print detail
Flags: X - disabled
0 name="test" port=serial1 signal=cts on-condition=change log=no script=""
count=1 state=on
[admin@Wandy] tool sigwatch> print detail
Flags: X - disabled
0 name="test" port=serial1 signal=cts on-condition=change log=no script=""
count=1 state=on
[admin@Wandy] tool sigwatch> print detail
Flags: X - disabled
0 name="test" port=serial1 signal=cts on-condition=change log=no script=""
count=2 state=off
[admin@Wandy] tool sigwatch> print detail
Flags: X - disabled
0 name="test" port=serial1 signal=cts on-condition=change log=no script=""
count=2 state=off
[admin@Wandy] tool sigwatch>
In the port menu you can see what signal is used by serial cable. For example, without any cables it
looks like this:
[admin@Wandy] port> print stats
0 name="serial0" line-state=dtr,rts
1 name="serial1" line-state=dtr,rts
[admin@Wandy] port>
But after adding a serial cable to the serial port:
[admin@Wandy] port> print stats
0 name="serial0" line-state=dtr,rts
1 name="serial1" line-state=dtr,rts,cts
[admin@Wandy] port>
This means that the line-state besides the dtr and rts signals has also cts when a serial cable is
connected.
The example below will execute a script whenever on-condition changes to off:
[admin@10.Wandy] tool sigwatch> pr detail
Flags: X - disabled
0 name="cts_rest" port=serial1 signal=cts on-condition=off log=no
script=/system shutdown count=0 state=on
[admin@10.Wandy] tool sigwatch>
It means that if a serial cable is connected to the serial port, all works fine, but as soon as it is
disconnected, the router shuts down. It will continue all the time until the serial cable will not be
connected again.