Well, I edited the initial script that came to me by Simon into a very short version that suit my needs. The 5Ghz was eliminated and the wireless protocol was set to “nv2-nstreme-802.11”
After I changed all my networks into 10Mhz some months ago I actuall removed the scripts and scheduler from the CPE’s.
All I had left was the following code written on a piece of paper:
/name=“ChangeBand” owner=“admin”
paste the following text into the source window.
:local delais 5s
:local liste 5mhz,10mhz,20mhz;
:foreach band in=$liste do={
:if (![/interface wireless get wlan1 running]) do={
/interface wireless set wlan1 channel-width=$band wireless-protocol=nv2-nstreme-802.11
:delay $delais
}
}
/system script
add name=A policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api source=
“log info "Script A start"\r
\n:global counter\r
\n:set counter ($counter+1)\r
\n:if ($counter <= 5) do={/system script run B}\r
\n:log info "Script A end"”
add name=B policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api source=
“:global counter\r
\n:log info ("Script B run number:".$counter)”
add name=simulatereboot policy=
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api source=
“:global counter 0”
/system scheduler
add disabled=no interval=3s name=schedule2 on-event=A policy=
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api start-date=jun/17/2011
start-time=13:15:16
\
This one hereafter works continously:
/system script
add name=ChangeBand policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api source=“:local delais 5s\r
\n:local liste 10mhz,20mhz;\r
\n \r
\n:foreach band in=$liste do={\r
\n:if (![/interface wireless get wlan1 running]) do={\r
\n/interface wireless set wlan1 channel-width=$band wireless-protocol=nv2-nstreme-802.11\r
\n:delay $delais\r
\n}\r
\n}\r
\n”
If I remember well the counter didn’t work well. The script always worked. But it did do its job. Switching the bandwith on the AP made all clients to follow within some time.
The reason I removed the scripts later was when clients were for whatever reason disconnected from AP the sripts started to test and swap the bandwidths which cost them at times quit some time to come back on time. On marginal links (and at the time the disconnection issues with NV2) this was disrupting my whole network. (Because of the NV2 process).
But thanks Simon, for giving some credit to the mutual developed script.