Thanks for the suggestions. In fact, a line was missing from the script.
The last line of that script is "rm -rf /var/squid/old_cache" (below
/etc/init.d/squid start).
Yes, I decided to move it out of the way (the cache is not on it's own
partition) as it's quicker that trying to remove it.
Thanks.
---------------------
Jim Matthews
ISS Systems Administrator
Duke University - Perkins Library
Box 90196
Durham, NC 27708
Email: jim.matthews@duke.edu
Voice: 919-660-5963
Fax: 919-684-6990
Tim Donahue <tdonahue@haynes-group.com>
09/08/2004 12:29 PM
To
"A. Sajjad Zaidi" <sajjad@iinix.com>
cc
Jim Matthews <jim.matthews@notes.duke.edu>, Squid-Users
<squid-users@squid-cache.org>
Subject
Re: [squid-users] clearing a squid cache
On Wed, 2004-09-08 at 12:18, A. Sajjad Zaidi wrote:
> On Wed, Sep 08, 2004 at 11:43:50AM -0400, Jim Matthews wrote:
> >
> > I have the following script:
>
> <snip>
>
> > mv $SQUID_CACHE /var/squid/old_cache
>
> I can see two problems with that. If your cache is on it's own mounted
> partition, as is common on large proxy servers, moving the directory can
> cause things to break.
>
> Secondly, caches can be pretty big. By renaming the old cache, you might
> end up wasting space when the new cache starts to fill.
>
> Might want to modify the script to delete everything under the cache
> directory (rm -rf $SQUID_CACHE/*) and then recreate it using 'squid -z'.
I believe the point of moving the cache directory in the first place was
to speed the process. My doing a 'rm -rf', someone please correct me if
I'm wrong, you will need to wait for the operation to complete. A
better option may be:
========
#!/bin/sh
#
# script to shutdown squid, remove old and initialize new cache_dir
#
SQUID_CACHE=/var/squid/cache
SQUID_DIR=/usr/local/squid
/etc/init.d/squid stop
mkdir $SQUID_CACHE/RemoveMe && mv $SQUID_CACHE/* $SQUID_CACHE/RemoveMe
rm -rf $SQUID_CACHE/RemoveMe &
$SQUID_DIR/sbin/squid -z
/etc/init.d/squid start
=====
Of coarse if you cache is mounted on its own partition, substituting
newfs will probably be even faster than trying to remove the old cache
directory.
Tim Donahue
Received on Wed Sep 08 2004 - 11:11:52 MDT
This archive was generated by hypermail pre-2.1.9 : Fri Oct 01 2004 - 12:00:02 MDT