I'm trying to reduce the overhead on our database server. I use a php script to produce sitemaps of all the pages on out site, 80,000.
I want to create a cron job which will run once a week and create static versions of the php sitemap files.
However, I need to loop around and call the sitemap php script and output the contents to a separate file.
How do I output the contents of another php to a file for a cron job ?
EDIT: I'll also need to wait or sleep a while so I don't bring down the server.
EDIT for Arvin for the flow of the PHP script etc
At the moment I have a sitemap.xml file which is a sitemap index file, which has lot of www.mydomain.com/sitemap.php?start=500&max=500
The sitemap.php take between 1 second and 2 seconds to run and I have a lot of them.
What I'd like to do in a new script is ...
New script
-loop from N = 0 to 100
--output sitemap.php&start=N&max=500
--wait 20 seconds
-end loop