There is no acn-only...there is acn-mixed and ac-only.
ah, that works! Thanks!
For ath0, the wireless network mode in the GUI is NG-Mixed but if I telnet and nvram show | grep ath0_net_mode it returns ng-only. So I guess I just assumed for AC/N-Mixed, the command would be acn-only following the ath0 pattern.
There is no acn-only...there is acn-mixed and ac-only.
ah, that works! Thanks!
For ath0, the wireless network mode in the GUI is NG-Mixed but if I telnet and nvram show | grep ath0_net_mode it returns ng-only. So I guess I just assumed for AC/N-Mixed, the command would be acn-only following the ath0 pattern.
I think I'll just do ac-only as you suggested.
I just picked the closest match to what you were originally trying to use.
I personally use AC/N-Mixed ("acn-mixed")...it seems to be the most stable for my 5 Ghz connection.
Thanks for the help in this thread. This might be a dumb question but I keep thinking about it... Does turning the radio on and off daily and adjusting TX Power eventually wear out the router faster than if we never changed these settings?
Sorry for the delayed response.
I dont really think so, many devices turn off wifi modules to save power, think your phone, laptop, etc, its a solid state device so the most likely thing to kill it over time is heat, so when the wifi is off (disabled) its likely the chipset runs cooler and hence should last longer... in theory.. in the real world, assuming you dont run the router in crazy ambient temperatures that it would make any real difference what so ever.
Do you know anyway I could use this kind of script, but tweak it so the router actually disable and re-enable the Wi-Fi immediately after having disabled it, every hours, everyday?
Basically rebooting the Wi-Fi (but not the router), every hours
It would be so much appreciate if you could point me out what kind of script would allow me to do that!
I think you will find on most broadcom units you can use the built in (ddwrt) radio schedual just fine and this script would not be needed.
That said if you change the interface names etc the script in theory could be adapted.
I need to run this script. But looks like it doesnt work on my WR1043ND v2. I did everything you said plazma but I need help.
I want to turn on my wifi 10:00-20:00 other hours should be turn off. I send my settings:
statup script:
Code:
# PLAzmA WIFI Schedule Script Version 1.2
# WRITE SCRIPT OUT TO TMP
cat > /tmp/wificheduler.sh << 'EOF'
#!/bin/sh
START=1000
STOP=2000
WIFIMODE=mixed
# IF BOOT HAS NOT COMPLETED DONT RUN
if [ ! -f /tmp/boot_complete ]; then exit 1; fi
# IF TIME IS BEFORE START OR AFTER STOP AND HOSTAPD IS RUNNING, THEN BRING DOWN WIFI
if [ $(date +%H%M) -lt $START ] || [ $(date +%H%M) -gt $STOP ]; then if [ $(ps | grep hostapd | cut -c27-33 | grep -v grep) = hostapd ]; then echo "wifi off">/tmp/wificheduler.status; stopservice wland; nvram set ath0_net_mode=disabled; killall hostapd; mv /tmp/hostap_alive /tmp/hostap_dead; fi; fi
# IF TIME IS AFTER START TIME AND BEFORE END TIME AND WIFI HAS NOT BEEN WOKEN, WAKE IT UP
if [ $(date +%H%M) -gt $START ] && [ $(date +%H%M) -lt $STOP ]; then if [ ! -f /tmp/hostap_alive ]; then echo "wifi on">/tmp/wificheduler.status; nvram set ath0_net_mode=$WIFIMODE; sleep 10; stopservice lan; startservice lan; mv /tmp/hostap_dead /tmp/hostap_alive; fi; fi
EOF
# SET THE EXECUTE BIT
chmod +x /tmp/wificheduler.sh
# BRING DOWN WIFI ON BOOT
sleep 15
stopservice wland; nvram set ath0_net_mode=disabled; killall hostapd; touch /tmp/hostap_dead; touch /tmp/boot_complete
# DONT FORGET TO ADD THE CRONTAB JOB IN THE GUI (SANS QUOTES) "* * * * * root /bin/sh /tmp/wificheduler.sh"
# TO DEBUG TELNET IN AND RUN (SANS QUOTES) "while true; do cat /tmp/wificheduler.status; sleep 10; done"
# THEN YOU CAN USE "date YYYYMMDDHHMM" IN ANOTHER SESSION TO QUICKLY ADJUST TIME.
# NOTE: wificheduler.status IS TOGGLED AS THE COMMAND STARTS TO RUN AND
# hostapd_(status) IS TOGGLED AT THE END OF THE RUN.
# THUS IT ALLOWS YOU TO DEBUG IF SOMETHING GETS STUCK BY COMPARING THE TWO.
# CHANGE LOG:
# 1.2 ADDED DEBUG, PREVENT CRON SCHEDULE RUN UNTIL BOOT ENDS AND
# ENSURED SCRIPT WOULD STILL RUN IF /tmp BECOMES FULL
# 1.1 CHANGE TO USE SERVICE LAN FOR QUICKER RESTART
It gets IP from Remote Wife (This router is wireless client)
I manually triger turn of wife with this: /tmp/custom.sh wifioff
Then I turn on wifi with this : /tmp/custom.sh wifion
Now my ath0 can not restore the wireless bridge. I tried to connect this router to my iPhone Personal Hotspot. IT looks like connected (I see blue band on top) but ifconfig shows no IP after turn on:
The issue with the original script noting coming back up was why i ended up creating my own, also the bigger advantage of my code is it ensures if the router gets rebooted it downs the wifi in the appropriate off period should the reboot happen part of the way though the period.
Although the 841 router i wrote this for was similar to the 1043 it should also work, although ive not tested and i forget where my v1 1043 router went to... i think i maybe installed it some place... i forget.
I see you have a real AP and a virtual AP, anyway you have not stated what your trying to do with the radio scheduled.. are you trying to turn off just the guest network? or both?
I would forget about the guest network for the second, save your nvram out to a backup file and then get the script working first on the router without the virtual ap.
Secondary it appears in your copy paste that your setting the mode as mixed, where as in your screen shot your showing ng-mixed, so i would also adjust which ever one appropriately to your situation, requirement.
You can also telnet/ssh into the router over CAT5 and issue the commands from the script manually and one at a time, observe what happens, this is going to tell you exactly what part is failing for you.
Thank you very much for fast response plazma! I appreicated. Let me explain my case:
I have ath0 and ath0.1 (virtual)
ath0 is important lets focus on this. as you can see ath0 is Wireless Client not AP. It connects to my iPhone Personal Hotspot.
Your script looks great but I need to know how to debug for my case. I am not make sure my cron is working or not. I need simple code just testing cron. Second you said run script manually one a time but how? I guest start and stop time is correct 1000 and 2000 it is not second or internal I guess. Based on 24 hours. But your script has if clouses so I am not linux expert how can test the conditions one by one. Can you tell me the shell commands that you are used in scripts like /tmp/hostap_alive etc can you make list? I can test one bye one. I need simple cron task just for testing my cron is working or not. _________________ Kaan's World | @mkaand | PLEX Archive | Trakt.tv
I cant see why it would not work in client mode...
However while you are getting it working save the nvram, resetup without the virtual ap and test without it, once you get the scheduled working you can add that back in.
Do you have NTP working/setup ? if so the time is not set so the script probably fire at the times you expect.
you cant just type a file name, the boot complete is just a file flag/holder to check is exists you can use:
ls /tmp/boot_complete
As for checking the script is running, you can monitor the processes list to make sure its being started:
Although it runs fairly quickly so it might be hard to see it getting fired each minute...
Instead you probably want to check the tmp folder that the script is being created:
ls /tmp/wificheduler.sh
If its there startup script, you should also then have the boot complete flag:
ls /tmp/boot_complete
Assuming this is there you can then check status of what the script is done by doing:
ls /tmp/hostap*
cat /tmp/wificheduler.status
If you read my FAQ part of my original post i explain how the two above further.
However as i said remove the script for the second try manually issuing the commands over CAT5:
Start commands would be:
nvram set ath0_net_mode=$WIFIMODE
stopservice lan; startservice lan
The two above lines are separate commands and the bottom line needs both, as stopping the service without the start immediately after will see you getting locked out.
Note replace $WIFIMODE with your require mode, as someone else said this may need quote marks, however on the 841 unit i wrote the script for i needed none.
Try setting the ath0_net_mode and then check the nvram to see if its taken.
nvram show ath0_net_mode
Stop would be:
stopservice wland;
nvram set ath0_net_mode=disabled
killall hostapd
Like i said connect over CAT5, remove the virtual ap from the system for the moment, issues the commands manually and check that works and go from there.
When I started my router there is no wificheduler.status in tmp folder. But I can see wificheduler.sh file
I did adjust for my time zone. Router time is correct. Here is the setting but. Looks like there is a bug 31899 build. I am in GMT+3 but if I choose GMT+3 time is incorrect. If I choose GMT-3 time is correct.
I will follow your directions + debug mode (two session for testing) but something is wrong. Looks like cron is sleeping I guess. Because there is no .status file in tmp but startup script is working. If I manually triger your script its create status file. We should focus cron I guess. What do you think.
Boot complete result:
Code:
root@GARDEN:~# ls /tmp/boot_complete
root@GARDEN:~#
stopservice wland;
nvram set ath0_net_mode=disabled
killall hostapd
these are not stop my wifi in wireless client mode. It looks like radio off (really off) but It still connect to my iphone hotspot (wirelessly). I am sending this message via my iphone hotspot plus wifi radio is off. Sounds weird. _________________ Kaan's World | @mkaand | PLEX Archive | Trakt.tv
root@GARDEN:~# nvram show | grep ath0_net_mode
ath0_net_mode=ng-only
size: 29498 bytes (36038 left)
nvram set ath0_net_mode=disabled
nvram set ath0_net_mode=ng-mixed
root@GARDEN:~#
GUI says NG-Mixed I confused. Above shell results. I believe if I do not use this router as Wireless Client your script will be work perfectly. But Wireless Client a little bit different. I need to solve this problem. If you wish I can give you access for my this router. Thanks. _________________ Kaan's World | @mkaand | PLEX Archive | Trakt.tv