I was thinking about some scripts I would like to fire off when a port is plugged in and active. Then a script I would like to run when the port is unplugged.
Is there something like netwatch for physical connections.
I was thinking about some scripts I would like to fire off when a port is plugged in and active. Then a script I would like to run when the port is unplugged.
Is there something like netwatch for physical connections.
You can use the scheduler to run a script every X seconds, checking for a particular interface being up/down.
:global ether3status
:if ([interface ethernet get ether3 running] = true) do={
:if ($ether3status = true) do={
:log info “ether3 up, already ran scripts”
} else={
:set ether3status true
:log info “ether3 up, running scripts”
run other commands…
}
} else={
:if ($ether3status = false) do={
:log info “ether3 down, already ran scripts”
} else={
:set ether3status false
:log info “ether3 down, running scripts”
run other commands…
}
}
hmmm…
Maybe.
My other idea was netwatch an IP. Set up a DHCP server to only give that IP.
Connection made.
IP given to device.
Netwatch cathes that the device is active.
Runs my script that is going to make about 8 config changes…
Ya, if you have the option to netwatch an IP address, that would be a good way to go.