#!/bin/sh
#
#  $Id: RunCache.in,v 1.1 1998/08/09 17:18:55 root Exp root $

prefix=/usr
exec_prefix=${prefix}
logdir=/var/squid
PATH=/usr/sbin:/bin:/usr/bin
export PATH

conf=""
if test "$1" ; then
	conf="-f $1"
	shift
fi

failcount=0
while : ; do
	start=`date '+%d%H%M%S'`
	squid -sYD $conf >> $logdir/squid.out 2>&1
	stop=`date '+%d%H%M%S'`
	t=`expr $stop - $start`
	if test 0 -le $t -a $t -lt 5 ; then
		failcount=`expr $failcount + 1`
	else
		failcount=0
	fi
	if test $failcount -gt 5 ; then
		exit 1
	fi
	sleep 10
done
