A great thank you for all people who answered me and helped
to recover lost files from copies stored in the squid cache.
Yes Stephane "ca marche"
Following a very short script I wrote in Tcl to help me
to do the job. Perhaps could it be useful to someone
in a similar situation :
#!/usr/local/bin/tclsh
#
#
# inthecache.list (should be adapted of course !)
# is here the file containing all the lines in <cache>/log
# which contains references to file I am interesting in recovering them.
# (I produced it with a grep command)
#
set lostf [open inthecache.list r]
#
# Top level directory of our find commands
#
set cacheroot /usr/local/squid/cache
#
# Recipient directory for our retrieved files
#
set copyroot /tmp/htdocs
#
# Let's iterate on each line of lostf
#
while {[gets $lostf line] >= 0} {
#
# Process line
#
# Each line consists in 6 fields.
# We are interested in :
# * the first which is the filename in the cache
# * the sixth which is the full specification of the original file.
#
# Replace every occurences of "at least one blank" by "one blank"
regsub -all {[ ]+} $line " " lineaux
# Split the results in a list
set llist [split $lineaux \ ]
# And work on the first and sixth element of the list
set cachef [lindex $llist 0]
set origif [lindex $llist 5]
puts "processing $cachef <----> $origif"
#
# We just keep the file name and forgets the path
# Doing so, we deliberately ignore the fact that
# our original files were perhaps stored at different
# directory levels, but ...the next version (if any
# I hope that no !) will perhaps process this.
#
set origif [file tail $origif]
#
# Let's call our good old Unix find to locate the
# the file in the cache.
#
puts "looking for $cachef from toplevel $cacheroot"
set fullcachef [exec find $cacheroot -name "$cachef"]
if {[string length $fullcachef] > 0} then {
puts "I retrieved a copy of $origif in $fullcachef"
exec cp $fullcachef $copyroot/$origif
} else {
puts "I could not retrieve $cachef"
}
}
close $lostf
exit
Have a good week end
-- Michel Caillat, Service Informatique de l'Observatoire de Meudon, Telephone :(1) 45 07 76 35 e-mail : caillat@mesiou.obspm.frReceived on Fri Feb 21 1997 - 09:35:22 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:34:31 MST