A cron job is a process that you schedule to run periodically on a server. Before you pass out with boredom, consider what this can do for your website.
Say you want to grab dynamic data from the web, analyze it, and pass it on to your audience. Or you want to augment your blog with links and descriptions of stories from your favorite news sources and blogs. Creating this dynamically on each request is bad web citizenship, because it means that, as your audience grows, so does the server load on your source servers Plus, it’ll mean long load times on your site, and you won’t be able to do as much analysis and data crawling as you could if you aggregated it all on your server. Cron jobs will solve all these problems by running a process that you can cache periodically. Then, you can send your audience to the flat (cached) page, or run your analysis on demand from data collected throughout the day.
How do I run a cron job?
Most hosts provide either command-line root access (meaning you can schedule cron jobs directly), or they provide a tool that writes the code for you. My host, GoDaddy, has a ‘Cron Manager’ under the Content tab in the Hosting Control Center. From here, click “create cron job” and select the frequency you want the process to run.
In the Command line, you can enter the name of the file you want it to run (don’t hit the browse button, because the suggested syntax won’t work with the kind of php files you’re used to writing). Instead, type “wget http://www.yourdomain.com/somefile.php” where somefile.php is the absolute url of the file you want it to run. The GUI will construct the timing part of the script for you, so you don’t have to learn alien space math. But if you’re into that sort of thing, here’s a quick tutorial.
Once you’ve set the command line, set the cron to run within the next five minutes so you can make sure it’s working. Most GUIs will allow you to send the output of the cron job to your email address, so you can confirm that it works and debug if there are any problems. Once you’ve confirmed it’s working, go back and adjust the timing to the schedule you prefer, and append -q to the query. This will keep the cron from emailing you every time it runs.
Your final cron will look something like this:


Economic Analysis
Economic Calendar
Real Clear Markets
Undervalued stocks
Value Cruncher
Wikinvest
One Trackback
[...] you’ve created a chron job for this file (see “How do I get php files to run on a schedule?“), you’ll only need to add a loadFile line and a createChart line for each dynamic [...]