Koozali.org formerly Contribs.org

Getting old web sites in squid ?? *** Solved ***

Getting old web sites in squid ?? *** Solved ***
« on: November 09, 2006, 04:11:44 PM »
We use squidguard to filter our browsing. We renewed our web site recently but we kept getting the old web site in our browsers. We figured that the problem was that we kept getting the old cache from squid.

I should say first that I am no expert on squid. The following took me 6 or 7 hours of research and trial. Anyone who wants to rag on me feel free to do it but it is like a Phd Ridiculing a 1 year old, if you get satisfaction from this they go ahead. Constructive critisizm Im open to specially if technically Im leading people astray.

However I have spend so much time at this that I hope that it will be helpfull to other simpletons like myself in the "I wish someone would write that down category" I have writen it I think for the basic user becasue Im Simple (did I mention that ). I do hope it will help others of our ilk.

OS Esmith SMI Version 6.0
Squid Version Squid Cache: Version 2.4 STABLE6
(By the way if you want to know what version of squid you have type squid-v

How to create  new cache files
squid –v  
(current version of squid is Squid Cache: Version 2.4 Stable6)

1.Make copy of Open /etc/squid/squid.conf  . You could name it squid.conf.original You will need this file later on so do this. Its always good to have a backup anyway in case something goes wrong.
2. Open /etc/squid/squid.conf
3. Check to see if the following parameter is in the file, search a line that starts with:
Edit  it OR Add it to something like this. (Keep your numbers at the end if you have a line like this. )

cache_dir  ufs  /var/spool/squidtmp  100  16  256

Note the /var/spool/squidtmp can be any name or directory you like. Just something different from the where it is now. If you don’t have a line starting with cache_dir then the default I think for SME 6.0 Linux is by default /var/spool/squid check to see if this is were it is now you will want to make it different.

4. Now you must make the your new directory the same owner as squid. To do this use the chown command and type the following:
chown squid:squid /var/spool/squidtmp

Again note the path of /var/spool/squidtmp should be what every directory you have chosen as your new directory.

5. Now shutdown squid with squid –k shutdown
6. I don’t know if it works but I typed squid reload (I picked this up somewhere else)
7. Now type squid –z this should show rebuilding the new directories
 You should see the output like this.
2006/11/08 15:25:25| Creating Swap Directories
This is a good thing.
Take a look at the directory that you have specified as your new cache dir. There should be a whole mess of subfolders named 00 01 02 etc. that were not there before. This proves that it worked.
8. Restart squid
/sbin/service squid restart

10. Start a browser that uses the squid as its Web proxy cache to see if it works. If it does move on to next step.

9. Now you can delete the OLD cache

If your OLD cache directory was at /var/spool/squid
Cd /var/spool/squid
Mkdir JUNK
Mv ?? swap.state* JUNK
Rm –rf JUNK &

Now for those of you who are using E-SMITH SME Linux as you know (I hope) The SME Linux OS has this thing called templates. My instructions do not tell you how to integrate this into the template system. This means that once you have done the above instructions, if you rebuild the system (which I think will happen when you reboot) all of the changes you have made will be lost. You will be left with the default settings, your old cache directory. The point of this exercise is to do a one off cleaning out of the cache then put it back to normal. I have an aversion to changing things from their default unless I have a real good reason for it. Cause I dont know how it will impact the future.

So you SHOULD DO THE FOLLOWING because if you don’t when the system reboots you will be reset to the defaults anyway. Soo you might as well do it now when you have some control over it, as oppose to waiting for the system to do it and then I'm not sure what will happen.

10. Start by going to the old cache_dir. If it was “/var/spool/squid” go there.

Did you delete all the files and directories here as I asked you to in point 9 ? If you did then there should be nothing there. Great. You should have a nice clean /var/spool/squid with nothing there.

11. Now you want to go to the /etc/squid directory where the squid.conf and squid.conf.original file are. Basically you want to put everything the way it was when you started this little adventure. Again just for safety  move squid.conf  to a new file name eg:

mv squid.conf squid.conf.changes

12. Now copy squid.conf.original to squid.conf:

cp squid.conf.original squid.conf

Everything is now back to normal.

13. Once again you must shutdown squid and rebuild new directories and then restart squid, to do this, (you already know how to do this but here is:)

squid –k shutdown
squid reload
squid –z
/sbin/service squid restart

Of course you will want to delete now the cache that you created in steps 1-9 because now your back to the original that has been all cleaned up.
That does it.