Skip to content

Instantly share code, notes, and snippets.

@herveguetin
Created December 9, 2014 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save herveguetin/f0035f161d851ffe515a to your computer and use it in GitHub Desktop.
Save herveguetin/f0035f161d851ffe515a to your computer and use it in GitHub Desktop.
Quick, easy and dirty cache warmer based on sitemap.xml
#!/bin/bash
URL='www.domain.nd'
SITEMAP='sitemap.xml'
wget --quiet http://$URL/$SITEMAP --no-cache --output-document - | egrep -o "http://$URL[^<]+" | while read line; do
time curl -A 'Cache Warmer' -s -L $line > /dev/null 2>&1
echo $line
done
@osopolar
Copy link

wouldn't it be more efficient (less bandwidth use) to use curl -I, like:
time curl -A 'Cache Warmer' -s -I $line > /dev/null 2>&1

curl -I ... just ask for the header and close the connection.
see: http://serverfault.com/a/140977/184446

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment