|
|
| Purpose: | Monitor network connection and disconnection |
| Format: | NETMONITOR [/C [name]] |
NETMONITOR name CONNECTED | DISCONNECTED n command
| name | Network name |
| n | Number of repetitions (or FOREVER) |
| command | Command to execute when condition is triggered |
Usage:
The network name can be either LAN (for a local area network), WAN (dialup network), or the name of a wireless network. The network name can include wildcards.
The command line will be parsed and expanded before NETMONITOR is executed, so if you want to pass redirection characters or variables to command you will need to protect them (by enclosing in single back quotes, doubling the %'s, or using command grouping).
If you don't enter any arguments, NETMONITOR will display the networks it is currently monitoring.
The monitoring runs asynchronously in a separate thread. When the condition is triggered, the command will be executed immediately. This may cause problems if you try to write to the display or access files while the main TCC thread is also performing I/O. You may need to use START or DETACH in command to avoid conflicts.
NETMONITOR creates environment variables when a network is connected that can be queried by command. The variable is deleted after command is executed.
| _netname | The name (SSID) of the network |
| _netcount | The number of times the condition has been triggered |
Options:
| /C | If name is specified, remove the monitor for that network. Otherwise, remove all network monitors. |