Change LED Lights Depending If WAN Connection Is Receiving Data

Cheers for the reply.

I placed the above configuration into the 'system' file and now I have the orange and amber lights both on at the same time.

This is the other post I was referring to > Help for LED Configuration

I have modified the '/etc/rc.local' to suit my router

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

#Check WAN Connection
while :
	Status=$(ping -q -c 20 -W 1 > /dev/null 2>&1 && echo "ok" || echo "FAIL")
	if [ "$Status" = "ok" ]; then

	echo 255 > /sys/class/leds/pca963x:shelby:amber:wan/brightness
	echo 0 > /sys/class/leds/pca963x:shelby:white:wan/brightness


	echo 255 > /sys/class/leds/pca963x:shelby:white:wan/brightness
	echo 0 > /sys/class/leds/pca963x:shelby:amber:wan/brightness

	sleep 10

exit 0

I have also added in both lights to they function as normal. The script above simply controls the brightness of each lights so once is only one is on at one time.


config led
	option default '0'
	option sysfs 'pca963x:shelby:white:wan'
	option trigger 'netdev'
	option dev 'eth1.2'
	option mode 'link tx rx'
	option name 'WAN_ON'

config led
	option default '0'
	option name 'WAN_OFF'
	option sysfs 'pca963x:shelby:amber:wan'
	option trigger 'netdev'
	option dev 'eth1.2'

However, I would like to know how to put a loop on this code if the WAN connection does go down. Any ideas?