mirror of
https://github.com/wezm/wezm.net.git
synced 2024-12-23 12:39:53 +00:00
5 lines
No EOL
972 B
HTML
5 lines
No EOL
972 B
HTML
On a number of sites at work we employ a static file caching extension to do just that: create static files that are served until the cache is invalidated. One of things that will invalidate the cache is deploying a new release of the code. This means that many of the requests after deploying will need to be generated from scratch, often causing the full Rails stack to be started (via Passenger) each time. To get around this I came up with the following to use <code>wget</code> to spider each of the URLs listed in the <code>sitemap.xml</code>. This ensures each of the major pages has been cached so most requests will be cache hits.
|
|
|
|
<p style="text-align: left;"><code>wget --quiet http://www.example.com/sitemap.xml --output-document - | egrep -o "http://www\.example\.com[^<]+" | wget --spider -i - --wait 1</code></p>
|
|
|
|
That should all be executed on one line. There's a one second wait in there to spread out the requests a bit but you can remove it if you like. |