Created
May 2, 2014 16:18
-
-
Save flusher/8bd1189b142dbb8fd57c to your computer and use it in GitHub Desktop.
Website cache warmer from multipages XML sitemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Warm cache from XML sitemap with multiple pages | |
url="www.example.com" | |
xmlsitemap="sitemap.xml" | |
pages=2 | |
log_file="/var/log/cache_warmer.log" | |
echo $(date +"[%d/%m/%Y : %T]") "Cache warmer launched for $url" >> $log_file | |
for p in `seq $pages` | |
do | |
wget -q --no-cache "http://$url/$xmlsitemap?page=$p" -O - | | |
egrep -o "http://$url[^<]+" | | |
while read line; do | |
curl -A 'Cache Warmer' -s -L $line > /dev/null 2>&1 | |
echo $line >>$log_file | |
done | |
done | |
echo $(date +"[%d/%m/%Y : %T]") "Cache warmer ended for $url" >> $log_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment