I setup my router to on-off the wireless LAN using crontab and using the QSS button.
I have a table that swithces off the wlan during the night at certains hours and turns it on in the morning, the evening and in weekends.
When I need wifi in other times I use the switch.
I would like that when the router boots the QSS led turns on only if the previous condition of wifi is ON.
Otherwise could be enough to force the wifi_on (or wifi_off) script at boot to condition the QSS led to the real state of wifi.
Both ways are good, but I dunno how to make them.
I'm using 1.5.6 Gargoyle
Theese are my scripts:
/etc/crontabs/root
Code: Select all
0 0,4,8,12,16,20 * * * /usr/bin/backup_quotas >/dev/null 2>&1
0 1,3,5,10 * * 1,2,3,4,5 /sbin/wifi_off
0 7,19 * * 1,2,3,4,5 /sbin/wifi_on
0 1,3,5 * * 0,6 /sbin/wifi_off
0 7 * * 0,6 /sbin/wifi_on
0 0,4,8,12,16,20 * * * date -u +"%Y.%m.%d-%H:%M:%S" >/usr/data/time_backup
0,1,11,21,31,41,51 * * * * /usr/bin/set_kernel_timezone >/dev/null 2>&1
Code: Select all
config 'button' 'reset_button'
option 'button' 'BTN_0'
option 'action' 'released'
option 'handler' 'logger restore defaults ; /usr/lib/gargoyle/restore.sh /etc/original_backup/backup.tar.gz 1 ; reboot ;'
option 'min' '3'
option 'max' '90'
config 'button' 'wifionoff'
option 'button' 'BTN_1'
option 'action' 'released'
option 'handler' '/sbin/wifionoff'
option 'min' '0'
option 'max' '2'
config 'led' 'led_onoff'
option 'sysfs' 'tl-wr1043nd:green:qss'
option 'trigger' 'timer'
option 'mode' 'link'
option 'default' '1'
option 'delayon' '2000'
option 'delayoff' '3000'
config 'button' 'reboot_button'
option 'button' 'BTN_1'
option 'action' 'released'
option 'handler' 'logger reboot ; /usr/lib/gargoyle/reboot.sh ;'
option 'min' '3'
option 'max' '90'
config 'led' 'wlan_led'
option 'name' 'WLAN'
option 'sysfs' 'tl-wr1043nd:green:wlan'
option 'trigger' 'phy0rx'
config 'system' 'system'
option 'hostname' 'Gargoyle'
option 'timezone' 'CET-1CEST,M3.5.0/2,M10.5.0/3'
config timeserver ntp
list server 0.pool.ntp.org
list server 1.pool.ntp.org
list server 2.pool.ntp.org
Code: Select all
#!/bin/sh
SW=$(uci -q get wireless.@wifi-device[0].disabled)
if [ "$SW" == "0" ] ; then
echo 0 > /sys/class/leds/tl-wr1043nd\:green\:qss/brightness
else
echo 1 > /sys/class/leds/tl-wr1043nd\:green\:qss/brightness
echo timer > /sys/class/leds/tl-wr1043nd\:green\:qss/trigger
echo 3000 > /sys/class/leds/tl-wr1043nd\:green\:qss/delay_off
echo 2000 > /sys/class/leds/tl-wr1043nd\:green\:qss/delay_on
fi
[ "$SW" == "1" ] && uci set wireless.@wifi-device[0].disabled=0
[ "$SW" == "1" ] || uci set wireless.@wifi-device[0].disabled=1
wifi
Code: Select all
#!/bin/sh
uci set wireless.@wifi-device[0].disabled=0
wifi
echo 1 > /sys/class/leds/tl-wr1043nd\:green\:qss/brightness
echo timer > /sys/class/leds/tl-wr1043nd\:green\:qss/trigger
echo 3000 > /sys/class/leds/tl-wr1043nd\:green\:qss/delay_off
echo 2000 > /sys/class/leds/tl-wr1043nd\:green\:qss/delay_on
Code: Select all
#!/bin/sh
uci set wireless.@wifi-device[0].disabled=1
wifi
echo 0 > /sys/class/leds/tl-wr1043nd\:green\:qss/brightness
Thank you very much
I hope somebody will like this configuration