TELNET ON SCRIPT run by terminal but not from scheduler

Hi All,

Scenario
I want check a single ipsec tunnel and if down, flush his sa
in this tunnel I can connect only in web server exposed over proxy and with system auth. (no login page)

my solutions
for check I used Telnet on web port 8080 (no fetch, no ping, … )

1st script
:global CHKAPI

:set CHKAPI “start”

/system telnet address=x.x.x.x port=8080;

/ip ipsec installed-sa flush;
:log warning “VPN API DOWN flush SA”
:set CHKAPI stop2nd script
:global CHKAPI

delay 10s

:if ($CHKAPI = “start”) do= {
delay 30s
/system script job remove [/system script job find script=“CHK_API”];
:set CHKAPI stop
}I tested It from terminal sys script run script_name
and are OK but when i scheduled or run by winbox task script RUN

the telnet don’t run … :frowning:

I tested on rb2011, rb750, x86 on many routeros version from 5.15 -6.15

Help Me please
How can I solve for me is very important to check that the vpn and web server is ok

Ths
Senzatempo

How you close telnet session on script once started?

Non c’ho capito niente…

My problem is that telnet don’t run in script but only in terminal interactive.
in my script I kill script job when telnet session is open (chk ok) or flush sa when telnet session is auto close don’t connect
I try with ssh that run in script but i don’t able to capture the ssh output or error connection.

senzatempo

I asked Mikrotik support a while ago about this and the response was that telnet within a script currently does not work…
Although it might function well in console.