Community discussions

MikroTik App
 
millenium7
Long time Member
Long time Member
Topic Author
Posts: 538
Joined: Wed Mar 16, 2016 6:12 am

Triggered execution? Interface up/down etc

Tue Aug 20, 2019 9:12 am

Is there a way to have scripts run on a triggered event rather than by scheduler?
In particular i'm looking for a way to run a script when an interface goes up or down

I can see this can be done on VRRP or PPPoE servers (via profile) but I actually need an event to run when the PPPoE Client interface goes down/up
 
User avatar
sebastia
Forum Guru
Forum Guru
Posts: 1782
Joined: Tue Oct 12, 2010 3:23 am
Location: Antwerp, BE

Re: Triggered execution? Interface up/down etc

Tue Aug 20, 2019 12:55 pm

Hey

To my knowledge not directly. There is the netwatch, with up & down scripts, but it's no synchronous. It will not be triggered by event, but by (delayed) detection.
 
nescafe2002
Forum Veteran
Forum Veteran
Posts: 897
Joined: Tue Aug 11, 2015 12:46 pm
Location: Netherlands

Re: Triggered execution? Interface up/down etc

Tue Aug 20, 2019 1:07 pm

PPP profile works for servers and clients.

/ppp profile
add name=profile1 on-down="/log info \"Client disconnected\"" on-up="/log info \"Client connected\""
/interface pppoe-client
add name=pppoe-out1 profile=profile1 user=test

Result:

12:05:10 pppoe,ppp,info pppoe-out1: authenticated 
12:05:10 pppoe,ppp,info pppoe-out1: connected 
12:05:10 script,info Client connected  <------
12:05:19 pppoe,ppp,info pppoe-out1: terminating... - administrator request 
12:05:19 system,info device changed by admin 
12:05:19 pppoe,ppp,info pppoe-out1: disabled 
12:05:19 script,info Client disconnected  <------
 
millenium7
Long time Member
Long time Member
Topic Author
Posts: 538
Joined: Wed Mar 16, 2016 6:12 am

Re: Triggered execution? Interface up/down etc

Tue Aug 20, 2019 1:57 pm

Ah maybe it does work then. I'll lab it up tomorrow and see how it goes

Nothing for ethernet though I presume?
 
millenium7
Long time Member
Long time Member
Topic Author
Posts: 538
Joined: Wed Mar 16, 2016 6:12 am

Re: Triggered execution? Interface up/down etc

Wed Aug 21, 2019 7:31 am

Yep works perfectly, thanks
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1070
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Triggered execution? Interface up/down etc

Thu Aug 22, 2019 12:10 am

Nothing for ethernet though I presume?
Sadly no. That's on my wishlist as well.
 
int21
just joined
Posts: 23
Joined: Thu Apr 16, 2009 1:31 am
Location: Brazil
Contact:

Re: Triggered execution? Interface up/down etc

Thu Nov 19, 2020 11:06 pm

When I try killing in active session do not execute on-down, any tip ?

Who is online

Users browsing this forum: No registered users and 18 guests