I would like to have a condition clause , whereby if im unable to ping to an IP (x.x.x.x) , then my Ethernet 2 Interface will be enabled.
::local PingTarget 172.16.200.2
::local Int1 ether1
::local Int2 ether2
::local FailTreshold 3
::local PingFailCount
::if ([:typeof $PingFailCount] = “nothing”) do={:set PingFailCount 0}
::local PingResult
::set PingResult [Ping $PingTarget count=1 interface=$Int1]
::put $PingResult
::if ($PingResult = 0) do={
:if ($PingFailCount < ($FailTreshold+2)) do={
{ :set PingFailCount ($PingFailCount +1)
: :if($PingFailCount = $FailTreshold) do={
interface ethernet enable ether2
}
}
}
My current script
