From f1b6453329ebf23012f8ac4c693097b598e44107 Mon Sep 17 00:00:00 2001 From: klever1988 <56048681+klever1988@users.noreply.github.com> Date: Tue, 24 Mar 2020 16:32:20 +0800 Subject: [PATCH] Create check_wan.sh --- scripts/check_wan.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 scripts/check_wan.sh diff --git a/scripts/check_wan.sh b/scripts/check_wan.sh new file mode 100644 index 0000000..81cb712 --- /dev/null +++ b/scripts/check_wan.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +source /lib/functions/network.sh +network_find_wan NET_IF +network_get_gateway NET_GW "${NET_IF}" + +r=`ping -c1 "${NET_GW}"` +r=`echo $r | grep Permitted` +while true; do + if [[ "$r" != "" ]] ;then + /etc/init.d/firewall restart + fi + sleep 2 +done