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
