Hey guys, i need script which checks specific ip’s port to see if it open or not and if it open then do nothing if its closed then run another specific script.
i made this but it does not work
:local telnetOutput [/system telnet 192.168.7.25 80]
:if ($telnetOutput = "") do={
:log info "Telnet connection to port 80 on 192.168.7.25 failed. Executing script script2..."
/system script run script2
:log info "Script script2 executed."
} else={
:log info "Telnet connection to port 80 on 192.168.7.25 successful. No action required."
}
:local test [/system telnet 192.168.25.7 80]
:put "Text should come after this"
:put "==========================="
:put $test
:if ($test = "") do={
/system script run ping_test_me
} else={
:log info "Telnet connection to port 80 on 192.168.25.7 successful. No action required."
}
If you did read what I did write: Will not work since the output are sent to a the console and not to a variable.
The post was just to show that nothing was stored in the variable…
I suggested, it may work with SSH, but I have not tested it, so its just more of some to try.