There is a package called 'wifitoggle' that does the same thing as the scripts below but is more advanced and has configuration. See Wifi ON OFF buttons
The scripts below allow the use of the SES button to enable or disable the wireless, this is achieved by adding a hotplug handler which reacts on button press events and a toggle script which enables or disabled the wireless depending on the current state.
Note: If you are using wireless encryption, nas and radius daemons will not be turned off during toggle and will continue to occupy cpu/memory. They should not consume too many resources with no client load though.
At the beginning, create a file called
/sbin and paste the content of the script into it.
Then make the file executable with the
chmod +x /sbin/woggle command.
This new revision aims to fix the issues previously noticed with the old script. It also uses the commands
wifi up and
wifi down that are supposed to be the right way to turn on or off the device.
Don't forget to change the value of device according to your case.
To get hotplugging working, create a directory in
button and then create a file in
Paste the following content into that file:
Now, every time you want to turn the wireless on or off, you can press the button on the router, or you can issue a
woggle command from the OpenWrt shell.