HTML Basix - HTML tutorials and online webmaster tools

Htaccess code generators Code generators Tutorials

Subscribe to RSS feed
Subscribe to the HTML Basix RSS feed.

Set up a cron job

A cron job is a process that is automatically run at whatever time you set it to run. This can be each day, each hour of every day, every 5 minutes of every hour of every day.

Setting up a cron job can be a daunting task if you don't know what you're doing. It appears to be a lot harder than what it actually is. Hopefully, with the use of our generator and tips on how to get your cron job running, you will find it a lot easier.

  • determine how often you would like this process to run - which minute of which hour of which days
  • hold down the (ctrl) key to choose multiple values in the one select box
  • choose the times/days/months you would like to run the process. The checkbox below the hours/day selection is if you would like to run the process regularly, for instance, choose '5' and check the checkbox underneath to choose every 5 minutes.
  • if you want the process to run every day, don't choose anything from the 'day' list. Same for months - day of week - hours. A non-selection from a list will assume * all *

cron details
'0' is the first minute, ie 2.00 as opposed to '1' being 2.01
NOTE: you MUST choose a minute here if you do not want the
cron to run EVERY MINUTE!

choose every minute
'0' is midnight, ie 12.00 am as opposed to '1' being 1.00 am
'22' is 10pm

choose every hour
Choose whether you want the cron to run every day, every x days or the xth day of the month. As well as choosing a value here, you can choose a day of the week in the field further down and it will run on both that day and the days you select here.

choose every day
day of week:
Choose the day of week if you wish to run the script on certain days, ie every Monday. If you have selected values in the 'days' field above, the command will run on both the xx day of the month as chosen, AND the day/days of the week you choose here
command to be executed:
Enter the command which you want to run. This can either be a path to a script, or a 'special' command. If you're not sure of the server path to a file/script, SSH or telnet into your server and navigate to the directory where the file is. Type 'pwd' at the command line, this will tell you the server path to the directory where the script is. Add the file name to the end of this, and that's what you use above.
You can enter a command directly instead of having this entry point to a script.

examples of entries in this field:
perl /home/myaccount/backup.cgi
php /home/myaccount/clean_database.php
touch /tmp/file.lock
cp -Rfpud /home/myaccount /backup/myaccount/
send results to:
include errors in log
Sending any output from the script to /dev/null is basically sending it to a 'black hole'. If you don't need the results, then this is the best thing to do. If you want the output logged, enter the full server path of the log file here.

Results will open in a new window

Site Stats     
Total: 9,766,098 Total: 28,325,326
Today: 116 Today: 245
Yesterday: 309 Yesterday: 1,061
Past Month: 9,579 Past Month: 32,891

284 visitors in the last 24 hours
This page has been visited 451,895 times
There are currently 4 visitors online
click to see where
most people online at once:
286 visitors on 06/27/2012
   You beaut

This site is © HTML Basix 2003 - 2009