Skip to content

Instantly share code, notes, and snippets.

@xperimental
Created February 8, 2016 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xperimental/885d5c97f96236e2b2f3 to your computer and use it in GitHub Desktop.
Save xperimental/885d5c97f96236e2b2f3 to your computer and use it in GitHub Desktop.
Script to show client state on router led (for TP-Link WDR4300)
#!/bin/sh
readonly _on=default-on # can also be "timer" when you want it to blink
readonly _led=/sys/devices/platform/leds-gpio/leds/tp-link:blue:qss/trigger
readonly _counter=$(cat /sys/kernel/debug/batman_adv/bat0/transtable_local 2> /dev/null | grep -c 'W')
if [ "${_counter}" = "0" ]; then
echo "none" > ${_led}
else
echo "${_on}" > ${_led}
fi
#show client status on led
*/1 * * * * /usr/sbin/counter-led.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment