Shell script to warm up page cache from a sitemap or URL list.
warmup fetches every URL listed in an XML sitemap (or sitemap index) and discards the response, triggering the server to populate its page cache for each URL. It also supports plain-text URL lists. Sitemap index files are handled recursively — all child sitemaps are discovered and processed automatically.
bashcurlbc(only required when using--wait)
Run the install script to copy warmup to /usr/local/bin and make it executable:
sudo ./install.shAfter installation, you can run it from anywhere:
warmup https://www.example.com/sitemap.xmlwarmup <url> [options]
| Argument | Description |
|---|---|
<url> |
URL of the sitemap (XML) or URL list (plain text) to process. |
| Option | Description |
|---|---|
--bare, -b |
Treat the file at <url> as a plain-text list of URLs (one per line). Blank lines and lines beginning with # are ignored. |
--wait=<ms>, -w=<ms> |
Add a delay of <ms> milliseconds between requests. Default: 0 (no delay). |
--append-params=<params> |
Append an already URL-encoded query string to every fetched URL, including sitemap and list URLs. Separate parameters with & or repeat the option. |
--help, -h |
Show the help message and exit. |
Warm up all pages in an XML sitemap:
warmup https://www.example.com/sitemap.xmlWarm up all pages from a sitemap index file:
warmup https://www.example.com/sitemap_index.xmlWarm up all pages in a sitemap with a 200 ms delay between requests:
warmup https://www.example.com/sitemap.xml --wait=200Warm up pages from a plain-text URL list with a 500 ms delay:
warmup https://www.example.com/urls.txt --bare --wait=500Append multiple parameters to every request:
warmup https://www.example.com/sitemap.xml --append-params='nocache=1&source=warmup'Supply parameters without a leading ? or &, and URL-encode their names and values as needed. Quote the argument to prevent the shell interpreting &.
- The provided URL is fetched and parsed as XML.
- If the document is a sitemap index (contains
<sitemap>elements), all child sitemap URLs are extracted and queued for processing. - If the document is a regular sitemap (contains
<url>elements), all<loc>URLs are extracted and each one is fetched in sequence usingcurl. - Sitemap indexes may nest multiple levels deep —
warmupwill keep processing until all child sitemaps are exhausted.
- The provided URL is fetched as plain text.
- Each line is treated as a URL. Blank lines and lines beginning with
#are skipped. - Each URL is fetched in sequence using
curl.
- Responses are discarded (
-o /dev/null) — only the request is made. - Redirects are followed automatically (
-L). - A custom
User-Agent(CacheWarmerBot/1.0) is sent with each request. - An optional delay (
--wait) can be added between requests to avoid overwhelming the server.
See LICENSE.