Cron Jobs

Head Surfer
October 9th, 2008

Linux cron jobs can be a little tricky sometimes. However, here’s a quick reference chart:

The format of the cron job is as follows:

1 = The minute after the hour that you want it done
2 = The hour you want it done (Military Time)
3 = Day of the Month
4 = Month of the Year
5 = Day of the week

6 = ‘command’ that you want it to run

Example:

5 0 * * * /usr/local/bin/email

means –
5 – 5th minute after the hour
0 – In the 0 hour
* – Everyday of the month
* – Every month of the year
* – Everyday of the week

12:05am – around midnight everynight it would execute.

5 0 * * * /usr/local/bin/curl http://yourdomain.com/billing/autoinvoice_cron.php

executes http://yourdomain.com/billing/autoinvoice_cron.php at 12:05 am each night

crontab location for oshosting – /etc/crontab

, = and
1,2 – run it at two times: would run it at 1 and 2

running a php file as a cron
php /path/to/your/cron.php

some servers require you to use lynx:
/usr/bin/lynx -dump http://domain.com/file.php

minute This controls what minute of the hour the command will run on,
and is between ‘0’ and ’59’
hour This controls what hour the command will run on, and is specified in
the 24 hour clock, values must be between 0 and 23 (0 is midnight)
dom This is the Day of Month, that you want the command run on, e.g. to
run a command on the 19th of each month, the dom would be 19.
month This is the month a specified command will run on, it may be specified
numerically (0-12), or as the name of the month (e.g. May)
dow This is the Day of Week that you want a command to be run on, it can
also be numeric (0-7) or as the name of the day (e.g. sun).
user This is the user who runs the command.
cmd This is the command that you want run. This field may contain
multiple words or spaces.

How To Host A Website is a Web Hosting Review service. We provide web hosting reviews for best hosting, server hosting, cheap hosting and more as we answer the most important website hosting question - How To Host Website pages successfully.

Words visitors used that found this page online:


Disclosure: We are a professional review site that receives compensation from the companies whose products we review. We are independently owned and the opinions expressed here are our own. Please contact us if you would like your web hosting company considered for a web hosting and support review.
Back to top Copyright 2012 © How To Host A Website, An OS Hosting, LLC Company