Community discussions

MikroTik App
 
User avatar
bysard
Member Candidate
Member Candidate
Topic Author
Posts: 295
Joined: Thu Apr 22, 2010 2:53 pm

Connection/interface state event

Sun Jun 02, 2013 8:53 am

Hi,

I would like to schedulle an event, to run a script when a certain VPN connection becomes active or inactive. Is this possible?

Any help apreciated.
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: Connection/interface state event

Sun Jun 02, 2013 10:59 pm

in this script I have a pptp interface called pptp-out

ros code

{
local status [interface pptp-client get pptp-out running ]
if ($status = true) do={/log info running} else={/log error "not running" }
}
you can chage both action.
 
User avatar
bysard
Member Candidate
Member Candidate
Topic Author
Posts: 295
Joined: Thu Apr 22, 2010 2:53 pm

Re: Connection/interface state event

Mon Jun 03, 2013 10:01 am

Ty for the script. This is a script that has to be schedulled to be ran at some time. I need to run it automatically if a connection state changes. Not as a cron job.
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: Connection/interface state event

Mon Jun 03, 2013 10:16 am

you can add a netwatch rule, checking a remote address. In Up and Down add your script.
 
User avatar
bysard
Member Candidate
Member Candidate
Topic Author
Posts: 295
Joined: Thu Apr 22, 2010 2:53 pm

Re: Connection/interface state event

Mon Jun 03, 2013 4:10 pm

Thanks. Never use that before but it does exactly what I need. +K

Who is online

Users browsing this forum: Luanscps and 19 guests