Community discussions

MikroTik App
 
zakho1983
just joined
Topic Author
Posts: 5
Joined: Fri Mar 11, 2016 12:09 am

Schedule to enable and disable interface in mikrotik

Sat Mar 03, 2018 8:55 am

Hello
I want to enable an interface in mikrotik at 20:00 and disable it at 8:00 all days
Any one have this script to help me

Best regards

Sent from my TA-1021 using Tapatalk

 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 1735
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Randburg
Contact:

Re: Schedule to enable and disable interface in mikrotik

Sat Mar 03, 2018 12:45 pm

/system scheduler
add disabled=no interval=1d name="Disable Either??" on-event="/interface disable [find name="ether??"]" \
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=jun/21/2017 start-time=08:00:00

add disabled=no interval=1d name="Enable Either??" on-event="/interface enable [find name="ether??"]" \
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=jun/21/2017 start-time=20:00:00
MTCNA, MTCTCE, MTCRE & MTCINE
 
zakho1983
just joined
Topic Author
Posts: 5
Joined: Fri Mar 11, 2016 12:09 am

Re: Schedule to enable and disable interface in mikrotik

Sat Mar 03, 2018 1:30 pm

Dear name of interface is lan4
And in all days weekly i like do this

Sent from my TA-1021 using Tapatalk

 
haik01
Member
Member
Posts: 406
Joined: Sat Mar 23, 2013 10:25 am
Location: Netherlands

Re: Schedule to enable and disable interface in mikrotik

Sat Mar 03, 2018 10:29 pm

Use scheduler. Not the script.

I did this for my kids (after 20:00h no internet on eth4).... Works perfectly.

In System, Scheduler add a new scheduler. Set start date, time etc....

In the white box below with name "on event": /interface disable 3

The number 3 should be changed to the interface number of the Ethernet interface you want to disable.
 
zakho1983
just joined
Topic Author
Posts: 5
Joined: Fri Mar 11, 2016 12:09 am

Re: Schedule to enable and disable interface in mikrotik

Sun Mar 04, 2018 9:58 am

Use scheduler. Not the script.

I did this for my kids (after 20:00h no internet on eth4).... Works perfectly.

In System, Scheduler add a new scheduler. Set start date, time etc....

In the white box below with name "on event": /interface disable 3

The number 3 should be changed to the interface number of the Ethernet interface you want to disable.
Hello can i have your email to contact with u if you can help me to do it together? Thanks

Sent from my TA-1021 using Tapatalk

 
pe1chl
Forum Guru
Forum Guru
Posts: 6798
Joined: Mon Jun 08, 2015 12:09 pm

Re: Schedule to enable and disable interface in mikrotik

Sun Mar 04, 2018 12:08 pm

In the white box below with name "on event": /interface disable 3

The number 3 should be changed to the interface number of the Ethernet interface you want to disable.
This is incorrect advice! Do not use it!
Instead, use the method shown by CZfan.
(of course the ?? in his example should be changed to 4 in this case)
 
abjaterza
just joined
Posts: 9
Joined: Sat Jul 09, 2011 2:20 am

Re: Schedule to enable and disable interface in mikrotik

Tue Dec 04, 2018 12:34 am

As said by other members, just to clarify:

Code: Select all

/interface disable 3


where the 3 is the actual name of the interface as you can see it in the Interface list - by default ether1, ether2, and so on.
 
pe1chl
Forum Guru
Forum Guru
Posts: 6798
Joined: Mon Jun 08, 2015 12:09 pm

Re: Schedule to enable and disable interface in mikrotik

Tue Dec 04, 2018 2:08 pm

NO!! don't do that!
Use the [find name="xxx"] construct.
 
nescafe2002
Long time Member
Long time Member
Posts: 674
Joined: Tue Aug 11, 2015 12:46 pm
Location: Netherlands

Re: Schedule to enable and disable interface in mikrotik

Tue Dec 04, 2018 2:17 pm

or by name:

/interface disable lan4
 
User avatar
koolandrew
just joined
Posts: 21
Joined: Tue Dec 06, 2011 7:20 pm
Location: Toronto
Contact:

Re: Schedule to enable and disable interface in mikrotik

Tue Jun 30, 2020 4:26 pm

Can someone please correct my scritpt. I am trying to turn off wifi at night, which i recommend to everyone who has a wifi in their house, while they are sleeping, and turn it on automatically in the morning. I have followed the forums but unless i turn it off manually by using the "run script" command, it will not turn off. It turns on correctly.

1 name="DiisableWLAN" owner="admin"
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon
dont-require-permissions=no last-started=jun/29/2020 22:46:05 run-count=4
source=
interface wireless disable wlan1
interface wireless disable wlan2

2 name="EnableWLAN" owner="admin"
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon
dont-require-permissions=no last-started=jun/30/2020 06:30:00 run-count=16
source=
interface enable wlan1
interface enable wlan2

Schedule

[admin@MikroTik] /system scheduler> print
Flags: X - disabled
# NAME START-DATE START-TIME INTERVAL ON-EVENT RUN-COUNT
0 DisableWLAN jun/14/2020 22:40:00 1d DisableWLAN 17
1 EnableWLAN jun/15/2020 06:30:00 1d EnableWLAN 16
[admin@MikroTik] /system scheduler>

As mentioned it never starts at the start-time selected.
 
FRANKMUNOZ
newbie
Posts: 33
Joined: Mon Feb 24, 2020 12:59 am

Re: Schedule to enable and disable interface in mikrotik

Wed Jul 01, 2020 12:32 am

Can someone please correct my scritpt. I am trying to turn off wifi at night, which i recommend to everyone who has a wifi in their house, while they are sleeping, and turn it on automatically in the morning. I have followed the forums but unless i turn it off manually by using the "run script" command, it will not turn off. It turns on correctly.

1 name="DiisableWLAN" owner="admin"
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon
dont-require-permissions=no last-started=jun/29/2020 22:46:05 run-count=4
source=
interface wireless disable wlan1
interface wireless disable wlan2

2 name="EnableWLAN" owner="admin"
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon
dont-require-permissions=no last-started=jun/30/2020 06:30:00 run-count=16
source=
interface enable wlan1
interface enable wlan2

Schedule

[admin@MikroTik] /system scheduler> print
Flags: X - disabled
# NAME START-DATE START-TIME INTERVAL ON-EVENT RUN-COUNT
0 DisableWLAN jun/14/2020 22:40:00 1d DisableWLAN 17
1 EnableWLAN jun/15/2020 06:30:00 1d EnableWLAN 16
[admin@MikroTik] /system scheduler>

As mentioned it never starts at the start-time selected.

Friend, try esot and let us know:

/interface disable [find name="wlan "]
delay 36000;
/interface enable [find name="wlan "]


ELDONCITO.
 
User avatar
koolandrew
just joined
Posts: 21
Joined: Tue Dec 06, 2011 7:20 pm
Location: Toronto
Contact:

Re: Schedule to enable and disable interface in mikrotik

Wed Jul 01, 2020 4:41 pm

I have trieid the following, all without success

/interface disable [find name="wlan "]

/interface disable [find name="wlan"]

/interface disable wlan1

/interface disable wlan1
/interface disable wlan2

The last two work when i hit run script. And it turns back on in the morning without doing anything.

Any ideas from any, as this is super frustrating...as is way too often with Mikrotik
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 1735
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Randburg
Contact:

Re: Schedule to enable and disable interface in mikrotik

Wed Jul 01, 2020 5:17 pm

Below will disable all interfaces where name contains "wlan"
/interface disable [find where name~"wlan"]
Then it seems you have a spelling mistake in the script name, so correct this and should work

1 name="DiisableWLAN" owner="admin"
MTCNA, MTCTCE, MTCRE & MTCINE
 
User avatar
koolandrew
just joined
Posts: 21
Joined: Tue Dec 06, 2011 7:20 pm
Location: Toronto
Contact:

Re: Schedule to enable and disable interface in mikrotik

Wed Jul 01, 2020 5:49 pm

Thanks very much CZfan...i never saw it...i hope you are well in South Africa and staying healthy...

I have to be honest, when i think about it, i have had so many issue with Mikrotik wireless, especially with Apple products trying to connect over the last ten years, that i often give up for years at a time. I am using a CAP dual band, and i was hoping to use it instead of a Ubiquiti for my customersi but i still cannot connect specific devices to the 5g network...at least they can connect to something..which is better than my experience with Mikrotik HAP AC lite...where i cannot get Apple to connect at all.
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 1735
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Randburg
Contact:

Re: Schedule to enable and disable interface in mikrotik

Thu Jul 02, 2020 1:12 am

Personally can't recall if I ever had issues with devices connecting to eithe 2 / 5 Ghz, except in very noisy areas where neighbors wifi routers interfered so much with each other that the client devices failed to connect,
MTCNA, MTCTCE, MTCRE & MTCINE

Who is online

Users browsing this forum: Google [Bot] and 68 guests