Skip to content

Instantly share code, notes, and snippets.

@eksiscloud
Created May 22, 2021 07:43
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 eksiscloud/918eeef63db2f423f834f2306bdb6151 to your computer and use it in GitHub Desktop.
Save eksiscloud/918eeef63db2f423f834f2306bdb6151 to your computer and use it in GitHub Desktop.
Cache Warmer using sitemap
#!/bin/bash
# CACHE WARMER script for XML Sitemaps with MULTIPLE SUB-SITEMAPS:
# from: https://gist.github.com/JPustkuchen/f185bee60c5a36211cdf6f1c8f6deebe
# chmod u+x
DOMAIN='https://www.xyz.com'
wget -q $DOMAIN/sitemap.xml --no-cache -O - | egrep -o "$DOMAIN[^<]+" | while read subsite;
do
echo --- Reading sub-sitemap: $subsite: ---
wget -q $subsite --no-cache -O - | egrep -o "$DOMAIN[^<]+" | while read line;
do
echo $line:
time curl -A 'Cache Warmer' -s -L $line > /dev/null 2>&1
done
echo --- FINISHED reading sub-sitemap: $subsite: ---
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment