source: freewrt/package/busybox/files/if-watchdog@ 1334083d

freewrt_1_0 freewrt_2_0
Last change on this file since 1334083d was 1b91c61, checked in by Markus Wigge <markus@…>, 19 years ago

I added a small watchdog scripts useful for monitoring dial-up devices.
We need this because of unstable UMTS connections far outside of
our office.

If you set "watchdog on" in your interfaces the script checks each
minute if the interface is still present and UP.

After 3 failures the router will be rebooted immediately.

BTW: this is generic and might be used on every kind of interface.

git-svn-id: svn://www.freewrt.org/branches/freewrt_1_0@1891 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100755
File size: 370 bytes
Line 
1#! /bin/sh
2
3INTERFACE="$1"
4
5FAIL_COUNT=0
6FAIL_LIMIT=3
7
8while :; do
9 LINK_OK=0
10 if ip addr show "$INTERFACE" 2>/dev/null | grep -q UP; then
11 LINK_OK=1
12 fi
13 if [ $LINK_OK -eq 0 ]; then
14 FAIL_COUNT=$((FAIL_COUNT+1))
15 else
16 FAIL_COUNT=0
17 fi
18 if [ $FAIL_COUNT -ge $FAIL_LIMIT ]; then
19 /sbin/reboot -f
20 fi
21 sleep 60
22done
Note: See TracBrowser for help on using the repository browser.