Re: Squid restarting several times after rotating logs

From: Colin Campbell <sgcccdc@dont-contact.us>
Date: Thu, 7 Oct 1999 17:06:24 +1000 (EST)

Hi,

Here's how I rotate my logs, every night at midnight.
------------------------------------------------------
#!/bin/sh

prog=`basename $0`

ARCHDIR=/var/log/archive
LOGDIR=/var/log/squid
LOGS="access.log cache.log store.log"

cd $LOGDIR

# timestamp the logs
now=`date "+%Y%m%d.%H%M%S"`
if [ -z "$now" ]; then
        echo "$prog: cannot get date - exiting"
        exit 1
fi

for log in $LOGS; do
        if [ -f $log ]; then
                mv $log $log.$now
        fi
done

# get squid to rotate the logs
/squid/bin/squid -k rotate

# if everything worked, move the logfiles to the archive dir
sleep 30 # let squid catch up
for log in $LOGS; do
        if [ -f $log ]; then # the proper log exists
                mv $log.$now $ARCHDIR
        fi
done

# make 'em smaller
cd $ARCHDIR
for log in $LOGS; do
        if [ -f $log.$now ]; then # the proper log exists
                gzip $log.$now
        fi
done

exit 0
------------------------------------------------------------
I also set the rotate variable (logfile_rotate 0) in squid.conf to zero
"0" so I can name the files as I want.

Colin

On Thu, 7 Oct 1999, Raymond Brighenti wrote:

> Hi All,
>
> Sorry for the large email but I though including the log file might give
> people a better view of what's happening.
>
> Basically each day at midnight I have a cron job run
> (/usr/local/squid/bin/squid -k rotate) to rotate the Squid log files, the
> problem is that each time it does Squid restarts every 10 seconds or so 4
> or 5 times, it does this every day(night :).
>
> Is this because of the way I rotate the files?
> If so is there a better way to rotate the files?
>
Received on Thu Oct 07 1999 - 01:22:39 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:48:45 MST