Getting stuff out of the squid cache - your last backup of the internet

Getting stuff out of the squid cache - your last backup of the internet

Saving stuff from the web is great. Free infomation to fill a hardrive - what about if the web crashes? Someone has to have a backup! If your running squid its a smart thing to use after a hardrive crash. Before start downloading all those wallpapers and facebook photos again you might already have a backup copy.

Get all the readable list from the squid server cache when file in Oct where logged

perl -pe 's/^\d+\.\d+/localtime($&)/e;' /var/log/squid/access.log | grep Oct

Get all (a list of) the JPEGS from the squid server cache

for i in `cat /var/log/squid/store.log | grep SWAPOUT | grep image/jpeg |
awk ' { print $4 } '`; do echo $i | perl -p -e '/([\w]{2})([\w]{2})([\w]{2})/; print "/squiddata/cache/$2/$3/$i"'; done > mylist

and copy the above list to a safeplace

for i in `cat mylist`; do; cp $i safeplace/; done

and add the jpg extension

cd safeplace; for i in `ls`; do mv $i $i.jpg; done