On Linux you can schedule tasks using cron. To open up cron just run:
crontab -e
Something useful to paste into your crontab is this line:
Like most Linux configuration files, lines starting with # are comments. This comment shown above is helpful to show you the field order that a cron line is broken down into. Each cron is on it’s own line and it’s parameters are space separated. Here’s an explanation of the abbreviations found in the comment:
mh - minute of the hour (0-59)
hd - hour of the day (0-23)
dm - day of the month (1-31)
my - month of the year (0-12)
dw - day of the week (0-6, with 0 being Sunday)
command - command to run
For each value you can put an asterisk if you always want it to run. For example, if you put an asterisk for mh, the command will run every minute (see example 1).
You can also add a list by comma seperating values …
(see example 2).
Alternatively, you can use a range by using the hyphen …
(see example 3 and 4).
The last way you can provide a value is using a step value. For example, if you want to run a command every other day, you can basically provide the dm field with */2 …
(see example 5).
Here are a few examples that should help show how crontab entries work:
* * * * * echo "This is a test"
0 10,12,14 * * * echo "This is a test"
0 10-14 * * * echo "This is a test"
0 14 * * 1-5 echo "This is a test"
0 14 */2 * * echo "This is a test"
0 14 * * * echo "This is a test" >> /var/log/results.log 2>&1
Note that in example 6 above, I redirect standard output and standard error into a log file. This is a great way to grab the output from your cron.
This information was put together using these articles:
http://troy.jdmz.net/cron/
http://www.unixgeeks.org/security/newbie/unix/cron-1.html