Openwrt 自訂script - Light up LED when there is internet connection
root@openwrt:~# vi /etc/checkinternet.sh
#!/bin/ash
wget -q --spider http://google.com
if [[ $? -eq 0 ]]; then
echo "Online"
echo 1 > /sys/class/leds/buffalo\:green\:router/brightness
else
echo "Offline"
echo 0 > /sys/class/leds/buffalo\:green\:router/brightness
fi
Reference:#!/bin/ash
wget -q --spider http://google.com
if [[ $? -eq 0 ]]; then
echo "Online"
echo 1 > /sys/class/leds/buffalo\:green\:router/brightness
else
echo "Offline"
echo 0 > /sys/class/leds/buffalo\:green\:router/brightness
fi
http://unix.stackexchange.com/questions/190513/shell-scripting-proper-way-to-check-for-internet-connectivity
https://wiki.openwrt.org/toh/buffalo/wzr-hp-g300h
Comments