Community discussions

MikroTik App
 
essele
newbie
Topic Author
Posts: 29
Joined: Tue Jan 07, 2014 5:55 am

Event driven scripting?

Mon Jan 13, 2014 8:14 am

Hi,

I can't seem to find any mechanism for automatically calling a script as a result of certain events? (Other than traffic monitor and netwatch)

I would like to run a script when a pppoe link comes up, I know I can achieve the same result using netwatch or a regularly scheduled script, but I thought we ditched the idea of polling years ago! ;-)

Is there any event based way of doing this?

While I'm on the subject of scripting ... I see that Lua was introduced and then removed, that's a real shame ... are there any plans to relook at this?

Many thanks,

Lee.
 
amee
just joined
Posts: 16
Joined: Mon Apr 17, 2006 3:44 pm

Re: Event driven scripting?

Fri Jan 24, 2014 6:12 am

You may use scheduler. Try This:
/ sy sche add interval=5m name=schedule1 on-event="/ip firewall nat> :if ([ /interface pppoe-client get pppoe-out1 running] false) do={your script}"
 
essele
newbie
Topic Author
Posts: 29
Joined: Tue Jan 07, 2014 5:55 am

Re: Event driven scripting?

Fri Jan 24, 2014 3:00 pm

Thanks for the response, but you've nicely indicated my point.

This checks every five minutes, which has two problems...

1. There could be a 5 min (I know it could be one min) delay.
2. We're polling!

The router knows exactly when the link has come up ... why not have an option to run a script at that time?

Lee.
 
efaden
Forum Guru
Forum Guru
Posts: 1708
Joined: Sat Mar 30, 2013 1:55 am
Location: New York, USA

Re: Event driven scripting?

Fri Jan 24, 2014 5:45 pm

It doesn't exist. I put it in as a feature request before. I agree.. It would be great...

Sent from my SCH-I545 using Tapatalk