-
Notifications
You must be signed in to change notification settings - Fork 0
/
30-wanled.sh
33 lines (32 loc) · 1005 Bytes
/
30-wanled.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
#/etc/hotplug.d/iface/30-wanled
#written for TP-LINK Google OnHub LED names in mind, will need change values for other devices
[ "$INTERFACE" = wan ] || exit 0
if [ "$ACTION" = ifup ] ; then
# WAN interface went up
for i in 0 1 2 3 4 5
do
echo "default-on" > /sys/class/leds/blue:status-$i/trigger
echo "none" > /sys/class/leds/green:status-$i/trigger
echo "none" > /sys/class/leds/red:status-$i/trigger
done
fi
if [ "$ACTION" = ifdown ] ; then
# WAN interface went down
for i in 0 1 2 3 4 5
do
echo "none" > /sys/class/leds/blue:status-$i/trigger
echo "none" > /sys/class/leds/green:status-$i/trigger
echo "default-on" > /sys/class/leds/red:status-$i/trigger
done
fi
if [ "$ACTION" = free ] ; then
# WAN wire disconnected physically
for i in 0 1 2 3 4 5
do
echo "none" > /sys/class/leds/blue:status-$i/trigger
echo "none" > /sys/class/leds/green:status-$i/trigger
echo "none" > /sys/class/leds/red:status-$i/trigger
done
fi
exit 0