wan LED orange if no wan
Opened this issue · 0 comments
dr-ni commented
A script for the wan LED
#!/bin/sh
# requires nano /etc/config/system
# edit: option cronloglevel '9'
#
# Name Type Required Default
# cronloglevel integer no 5
#
# The minimum level for cron messages to be logged to syslog.
# 0 will print all debug messages,
# 8 will log command executions,
# and 9 or higher will only log error messages.
#
# copy script to /usr/sbin/chk_wan and
# add this script as additional cronjob with crontab -e
# * * * * * /usr/sbin/chk_wan
trials=0
while [[ $trials -lt 5 ]]
do
if /bin/ping -c 1 8.8.8.8 >/dev/null
then
echo 0 > /sys/class/leds/pca963x:rango:amber:wan/brightness
echo 255 > /sys/class/leds/pca963x:rango:white:wan/brightness
echo "wan ok"
#logger -t wancheck "wan is ok"
exit 0
fi
trials=$((trials+1))
done
echo 255 > /sys/class/leds/pca963x:rango:amber:wan/brightness
echo 0 > /sys/class/leds/pca963x:rango:white:wan/brightness
echo "wan error"
logger -t wancheck "wan error, no connection"
ifdown wan
sleep 1
ifup wan
exit 1