Community discussions

 
millenium7
Member Candidate
Member Candidate
Topic Author
Posts: 195
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: 1773
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
Long time Member
Long time Member
Posts: 617
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
Member Candidate
Member Candidate
Topic Author
Posts: 195
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
Member Candidate
Member Candidate
Topic Author
Posts: 195
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
Member
Member
Posts: 377
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.
Manage RouterOS scripts and extend your devices' functionality: RouterOS Scripts

Who is online

Users browsing this forum: Bing [Bot] and 7 guests