I have the following four scripts which will enable and disable the various ISP’s Each one is set to a separate interface.
[code]/system script
add name=EnableISP1 policy=ftp,reboot,read,write,policy,test,winbox,password,sniff source=“interface pppoe enable pppoe-out1”
add name=DisableISP1 policy=ftp,reboot,read,write,policy,test,winbox,password,sniff source=“interface pppoe disable pppoe-out1”
add name=EnableISP2 policy=ftp,reboot,read,write,policy,test,winbox,password,sniff source=“interface pppoe enable pppoe-out2”
add name=DisableISP2 policy=ftp,reboot,read,write,policy,test,winbox,password,sniff source=“interface pppoe disable pppoe-out2”[/code]
Now the scheduler is where I’m lost.
I need to trigger the above scripts at certain times, weekdays and not on weekends.
EnableISP1 - Weekdays 6:00am till 6:00pm
EnableISP2 - Weekdays 6:00pm till 6:00am & all weekend
If anyone knows how please help me out.
Here’s the scheduler documentation:
http://wiki.mikrotik.com/wiki/Manual:System/Scheduler
It’s easy to trigger it everyday, but that’s not ideal. I could add a 5 day interval but how would that work if the router reboots? It would reset the day interval :s
/system scheduler
add name="Enable ISP1" interval=12h start-time=06:00:00
add name="Disable ISP1" interval=12h start-time=17:59:50
add name="Enable ISP2" interval=12h start-time=18:00:00
add name="Disable ISP2" interval=12h start-time:05:59:50
An advanced way would be a script that runs every few seconds to check day & time then IF Monday > 06:00 < 18:00 then disable isp2 and enable isp1 etc.
This is a script I use for updating dynamic DNS: (runs every 5 minutes)
[code]##############Script Settings##################
:local NOIPUser “no-ip.com LOGIN”
:local NOIPPass “no-ip.com PASSWORD”
:local WANInter “MikroTik Router WAN Interface Name”
###############################################
:local NOIPDomain “$NOIPUser.no-ip.org”
:local IpCurrent [/ip address get [find interface=$WANInter] address];
:for i from=( [:len $IpCurrent] - 1) to=0 do={
:if ( [:pick $IpCurrent $i] = “/”) do={
:local NewIP [:pick $IpCurrent 0 $i];
:if ([:resolve $NOIPDomain] != $NewIP) do={
/tool fetch mode=http user=$NOIPUser password=$NOIPPass url=“http://dynupdate.no-ip.com/nic/update\3Fhostname=$NOIPDomain&myip=$NewIP” keep-result=no
:log info “NO-IP Update: $NOIPDomain - $NewIP”
}
}
}[/code]
some examples: http://wiki.mikrotik.com/wiki/Manual:Scripting-examples