Saturday, November 27, 2004

How do I schedule the server to generate static HTML files from other dynamic web pages?

Some people would use Perl or PHP to grab data from the database and generate the HTML when the scripts are executed. I'm just too lazy to write another script for a dynamic web page which is already written in languages such as PHP, Perl, ASP, JSP, ColdFusion, etc.


What I do is create a shell script file and utilize OS' pipe function and a text browser to create the HTML file.


For example: create a text file called generate.sh

lynx -source http://someURL.com/yourCode.asp > yourStaticASP.html
lynx -source http://someURL.com/yourCode.php?Var=123 > yourStaticPHP.html

and do a chmod on the file, make sure it is executable, e.g., chmod u+x generate.sh

You may then schedule this script file in your cron table ;-)

No comments: