nanopi-openwrt/scripts/check_wan4.sh

11 lines
231 B
Bash
Raw Normal View History

2020-03-24 16:32:20 +08:00
#!/bin/sh
while true; do
2020-03-27 21:09:32 +08:00
wan=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
r=`ping -c1 $wan 2>&1`
2020-03-26 07:31:44 +08:00
case $r in
2020-03-27 21:09:32 +08:00
*permitted* ) /etc/init.d/firewall reload ;;
2020-03-26 07:31:44 +08:00
esac
2020-03-24 16:32:20 +08:00
sleep 2
done