Community discussions

MikroTik App
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Disable Interface on Startup and enable 1 minute later

Wed Feb 18, 2015 9:04 am

Good day,


I have a weird case in my one clients mikrotik. This is more of a work around than a solution but it will be quicker for me to do this.

I am routing voip data out of a different gateway. However my VoIP only starts routhign through the other line after I disable my primary internet line.

So basically I want a script that on startup, disables interface x.

waits a certain period of time and then Enables the interface again.


Can I do this?
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6695
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: Disable Interface on Startup and enable 1 minute later

Wed Feb 18, 2015 10:05 am

/system scheduler
provides you with such functions.

Run script on startup (there is such parameter), disable interface (be careful as small delay might be required for it), then add your proposed delay (:delay 60s) and command to enable interface.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Disable Interface on Startup and enable 1 minute later

Wed Feb 18, 2015 11:02 am

Any Ideas on what that specific script might look like? I haven't got much experience with the scripting language.
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6695
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: Disable Interface on Startup and enable 1 minute later

Wed Feb 18, 2015 11:15 am

/system scheduler
add name=schedule1 on-event=":delay 5s;\r\
\n/interface ethernet disable ether1;\r\
\n:delay 60s;\r\
\n/interface ethernet enable ether1" policy=\
reboot,read,write,policy,test,password,sniff,sensitive start-time=startup
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Disable Interface on Startup and enable 1 minute later

Wed Feb 18, 2015 11:41 am

This works in the terminal but not in a script?


am I doing something wrong? im running v6.26

/interface pppoe-clinet disable Test
if I put that in a script and click run, nothing happens, put it in the terminal and it disables the interface?
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6695
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: Disable Interface on Startup and enable 1 minute later

Wed Feb 18, 2015 11:51 am

Use scheduler to run script, make sure Test is the name of your PPPoE interface.
 
KabTak47
just joined
Posts: 1
Joined: Wed Feb 18, 2015 1:38 pm

Re: Disable Interface on Startup and enable 1 minute later

Wed Feb 18, 2015 1:46 pm

At the moment RouterOS does not account milliseconds, and there are no too much setups where second is too big value for time.???
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Disable Interface on Startup and enable 1 minute later

Wed Feb 18, 2015 8:43 pm

Does script and scheduler not run the same scripting language?

Ok sweet, It is working now in scheduler.

Who is online

Users browsing this forum: Babujnik and 18 guests