From tomj@fido.wps.com Thu Feb 17 21:54:51 1994
Received: from fido.wps.com by fnord.tlg.org (8.3/wps.com-hackery)
	id VAA00267; Thu, 17 Feb 1994 21:54:48 -0800
Received: by fido.wps.com (5.67/wps.com-hackery)
	id AA18438; Thu, 17 Feb 94 21:55:03 -0800
Received: from [140.174.115.1] by fido.wps.com (5.67/wps.com-hackery)
	id AA15460; Thu, 17 Feb 94 03:15:34 -0800
Received: from localhost by steel.twilight.com (8.6.5/TCP/hacked/2.0)
	id DAA01230; Thu, 17 Feb 1994 03:16:20 -0800
Date: Thu, 17 Feb 1994 03:16:20 -0800
From: tom@twilight.com (Tom Markson)
Message-Id: <199402171116.DAA01230@steel.twilight.com>
To: tomj@wps.com
Subject: Slip Stuff Part 3
Sender: tomj@fido.wps.com
Status: O


Here's the final piece of the slip stuff I said I'd send you.  This script
sits in CRON and runs every 15 minutes.  It tries to ping my gateway 15
times and if that fails, restarts the connection.  If you want to use it,
you'll have to localize it.  The script "slipinet" it references is the
second piece of the mail I sent you - that part with the ifconfig's and such
in it.

Hope this stuff is useful to you.

#!/bin/sh
force=0
if [ "$1" = "-f" ]
then
	force=1
fi
count=0
while [ $count -lt 2 ]
do
	if [ $count -ne 0 ]
	then
		sleep 45
	fi

	if [ $force -eq 0 ]
	then
		if ( /sbin/ping -nc 15 140.174.122.3 >/dev/null)
		then
#			echo "`date` Net OK ">>/var/log/pingd
			exit 0
		fi
	fi
	force=0
	pid=`ps ax|grep slip|grep -v grep|awk '{print $1}'`
	echo "`date` net down. killing $pid and restarting" >>/var/log/pingd
	if [ ! -z "$pid" ]
	then
		kill -9 $pid
	fi
	/usr/local/bin/slipinet >/dev/null
	count=`expr $count + 1`
done
echo "`date` Couldn't restore host!" >>/var/log/pingd


