2012-01-01

WiFi toggle on Asus WL-550gE


I don't feel confortable sleeping with my wifi on, so here is a script to turn it off at night:

First I created 2 scripts, one to turn it off:

# vi /root/wifi-off

#!/bin/sh
 
uci set wireless.@wifi-device[0].disabled=1
wifi
echo wifi disabled

And one to turn it back on:

# vi /root/wifi-on

#!/bin/sh
 
uci set wireless.@wifi-device[0].disabled=0
wifi
echo wifi enabled


Then I started up wifi at boot

# vi /etc/rc.local

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

/root/wifi-on

exit 0


Crontab:

# crontab -e

 0  7 * * * /root/wifi-on
59 23 * * * /root/wifi-off


The cron service is not enabled by default in OpenWRT:

# /etc/init.d/cron enable
# /etc/init.d/cron start

Good night...

No comments:

Post a Comment