Skip to content

Instantly share code, notes, and snippets.

@flexoid
Last active March 19, 2017 14:02
Show Gist options
  • Save flexoid/2a9884fbbd704b405a59638aac7ab69d to your computer and use it in GitHub Desktop.
Save flexoid/2a9884fbbd704b405a59638aac7ab69d to your computer and use it in GitHub Desktop.

OpenWrt LED night mode

This simple script allows to disable all router LEDs (except power-on) at once, or enable them by resetting to default settings.

Can be useful for anyone who doesn't like LEDs blinking in the face at night.

Add something like this to crontab:

0 21 * * * /root/openwrt_leds_control.sh disable_all
0 6 * * * /root/openwrt_leds_control.sh reset
#!/bin/sh
case "$1" in
disable_all)
for file in /sys/class/leds/**/trigger; do echo "none" > "$file"; done
for file in /sys/class/leds/**/brightness; do echo 0 > "$file"; done
;;
reset)
for file in /sys/class/leds/**/enable_hw_mode; do echo 1 > "$file"; done
/etc/init.d/led reload
;;
*)
echo "Usage: $0 {disable_all|reset}"
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment