Hi,
On Tue, 28 Mar 2000, Henrik Nordstrom wrote:
> Jimmy Stewpot wrote:
>
> > are there any major benefits in using Squid as a daemon as apposed
> > to using it as a non-daemon. This has confused me as i am unsure
> > how much benefits there are in either way of running squid.
>
> The benefit of using the daemon mode compared to use the RunCache
> wrapper script is that it is easier to shut down the daemon mode. Simply
> squid -k shutdown will do it for you, while RunCache will automatically
> restart Squid if you do so. To shut down a RunCache monitored Squid you
> must first kill the RunCache script, and then shut down Squid.
>
> The benefit of using the RunCache wrapper is that you can easily add
> triggers when Squid is restarted. Triggers I have used include automated
> emails, and even automated stack traces from core dumps if any.
I like having RunCache monitor squid and restarting it when
necessary. However I also like being able to stop RunCache from restarting
oc occasions. That's why I modified RunCache to that below. To stop squid
altogether:
touch /tmp/squid.stop
squid -k shutdown
killall RunCache # or whatever
rm /tmp/squid.stop
-------------------------------------------------------------------------------
#!/bin/sh
#
# $Id: RunCache,v 1.3 1999/10/03 01:35:46 root Exp $
prefix=/squid
exec_prefix=${prefix}
logdir=${prefix}/logs
PATH=${exec_prefix}/bin:/bin:/usr/bin
export PATH
lockfile=/tmp/squid.stop
conf=""
if test "$1" ; then
conf="-f $1"
shift
fi
failcount=0
while : ; do
if [ -f $lockfile ]; then
echo "Lockfile ($lockfile) found - sleeping"
echo "squid locked at `date`" >> $logdir/squid.out 2>&1
while [ -f $lockfile ]; do
sleep 1
done
echo "squid released at `date`" >> $logdir/squid.out 2>&1
fi
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
-------------------------------------------------------------------
Colin
Received on Mon Mar 27 2000 - 23:30:58 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:52:27 MST