File: RunCache.in

package info (click to toggle)
squid 2.7.STABLE9-2.1%2Bdeb6u1
  • links: PTS
  • area: main
  • in suites: squeeze-lts
  • size: 13,896 kB
  • ctags: 14,016
  • sloc: ansic: 114,686; sh: 5,511; makefile: 1,362; perl: 1,359; awk: 40; sql: 8
file content (35 lines) | stat: -rw-r--r-- 713 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
#
#  $Id: RunCache.in,v 1.11 2005/05/17 16:56:36 hno Exp $

prefix=@prefix@
exec_prefix=@exec_prefix@
logdir=@localstatedir@
PATH=@sbindir@:/bin:/usr/bin
export PATH

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

failcount=0
while : ; do
	echo "Running: squid -sY $conf >> $logdir/squid.out 2>&1"
	echo "Startup: `date`" >> $logdir/squid.out
	start=`date '+%d%H%M%S'`
	squid -NsY $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
              echo "RunCache: EXITING DUE TO REPEATED, FREQUENT FAILURES" >&2
		exit 1
	fi
	sleep 10
done