MikroTik scheduler and scripts: useful examples
Last updated: 2 October 2026
The scheduler runs commands at set times; a script is a saved set of commands with a name. Together they automate the routine jobs on a router.
How the scheduler works
/system scheduler add name=example start-time=03:00:00 interval=1d on-event="/log info \"scheduler ran\""start-time: when it first runs. Use a clock time, orstartupto run at every boot.interval: how often after that.1d,1h,5m. Zero means once.on-event: the commands, or the name of a script.
The router clock must be right: System → Clock, and set up System → NTP Client.
Reboot every night
/system scheduler add name=nightly-reboot start-time=04:00:00 interval=1d on-event="/system reboot"Backup every night
/system scheduler add name=nightly-backup start-time=03:00:00 interval=1d on-event="/system backup save name=auto-backup"Wi-Fi off at night, on in the morning
/system scheduler add name=wifi-off start-time=23:00:00 interval=1d on-event="/interface disable wlan1"
/system scheduler add name=wifi-on start-time=06:00:00 interval=1d on-event="/interface enable wlan1"On newer devices the interface may be called wifi1. Check with /interface print.
A named script, run by the scheduler
/system script add name=check-line source={
:if ([/ping 8.8.8.8 count=3] = 0) do={
:log warning "internet check failed"
}
}
/system scheduler add name=check-line interval=5m on-event=check-lineRun and debug
/system script run check-line
/system script print
/log print where topics~"script"Mistakes to avoid
- Loops without a pause. A script that loops forever with no
:delaycan use all the processor. - Two jobs doing the same thing. They undo each other. Keep one.
- Scripts that read dates as text. RouterOS v7 writes dates differently from v6; such scripts break on upgrade.
- Wrong clock. A router without time sync runs everything at the wrong time after a power cut.
- Quotes inside quotes. Long scripts pasted inside
on-event="…"break easily. Save them as a named script and call the name.
Where RadiusNest fits
Many operators' longest scripts exist to expire users, count data and print vouchers. Those are the jobs RadiusNest does from the cloud, so the router is left with short scripts like the ones above.
Start the free trial See pricing
Questions and answers
Why does my scheduler not run?
Check the clock, the start-time and that the scheduler is enabled. Its run count in /system scheduler print shows whether it fired.
What does start-time=startup do?
It runs the job each time the router boots, then repeats at the interval if one is set.
Where do I see script errors?
Run the script by hand in a terminal; errors appear there. The log also records script problems.