I am not an expert in this so I have some newbie questions.
If I understand correctly, I have to copy paste this script into a file named ap-toggle.sh, the file would be located in the router's /usr/bin/ and then Icall it with a cronjob.
My scenario should be:
0 2230 /usr/bin/ap-toggle.sh off radio1, radio2
0 0630 /usr/bin/ap-toggle.sh on radio1, radio2
radio0 should be unaffected.
How is the notation for switching off at 22.30 and turning back on on 06.30 every day? I am unsure the one I wrote is the correct one.
How to automate this? I see I have to reference this script in /etc/crontabs/root but I do not know how to do that.
What if the router is powered off at 22.29 and turns back on at 22.32? The cronjob will fail?
The script in the current form only accepts two parameters max.
To match your requirements, copy the script to /usr/bin, make it executable (chmod +x ...) and put the following commands to your cron config in /etc/crontabs/root (create this file if it doesn't exist):
30 22 * * * /usr/bin/ap-toggle.sh off radio1
30 22 * * * /usr/bin/ap-toggle.sh off radio2
30 06 * * * /usr/bin/ap-toggle.sh on radio1
30 06 * * * /usr/bin/ap-toggle.sh on radio2
Finally restart the cron service with /etc/init.d/cron restart.