Schedule to enable and disable interface in mikrotik

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

/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

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

Sent from my TA-1021 using Tapatalk

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

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)

As said by other members, just to clarify:
/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.

NO!! don’t do that!
Use the [find name=“xxx”] construct.

or by name:


/interface disable lan4

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.

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

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”

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.

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,

This seems good advice, but I am just wondering why is the construct better than just the name?

This was a reply to someone who used a number (3) to refer to the interface. Don’t do that, it won’t work.
Using a name instead of [find name=“xxx”] should work the same. But it is not allowed everywhere, so I tend to use the universal [find name=“xxx”] construct.

Never use directly the .id (3) on script, can change everytime (and often exist only after “print”)

Wrong, because .id must not be used

/interface disable 3

Both wrong, because wlan1 exist only as string, and can be misunderstanded

/interface disable wlan1
/interface disable “wlan1”

Work for single / all

/interface disable [find name=“wlan1”]
/interface disable [find name~“wlan”]

Correct syntax for single / all

/interface disable [find where name=“wlan1”]
/interface disable [find where name~“wlan”]

“Perfect” for single / all, because if you change interface name, the script still work…

/interface disable [find where default-name=“wlan1”]
/interface disable [find where default-name~“wlan”]

Correct way for disable / enable all wireless for night

/interface wireless disable [find]
/interface wireless enable [find]
and another consideration …

Why do some scripts, to be re-called in the scheduler (which a hidden “return/enter” can block),
and not directly put the script text in the scheduler???
Doing double duty, for nothing, only increases the chance of making mistakes…

My experience as well koolandrew, you would have to pry my MT router from my dead cold hands but I willingly gave away my capacs, except for one, for testing purposes.
I use tplink eap245 and then 6660HD and no issues with apple gear (mostly IOs phones).

(nice script err sorry, system scheduler solution there CZFAN)

Unfortunately, albeit a little late, i have had so many issues as well with Apple devices, i cannot begin to tell you. And the customers dont want to know about it, but nor does Mikrotik, unfortunately.

I have a CAP AC sitting in our office, in the box. I would be super excited to deploy it as well.