Cron can appear to be challenging at first, but with the proper help, you will find it easy and very helpful to automate tasks on your website.

Cron is simply a way to run any program/script on your web hosted account once a day, once a week, once a month, every Tuesday and Thursday, etc.

It is helpful in automatically performing web site maintenance, automating scripts that generate new sales/coupons/etc.  It can even help establish a back routine for your web site.

Cron is composed of five fields.  The following chart details each field.

Minute Hour Day of Month Month Day of Week
0 = 0

Such as in 1:00

1 = 1

Such as in 1:01etc.

* = Every Hour
0 = 12am
1 = 1am
2 = 2am
12 = 12pm
13 = 1pm

etc.

* = Every Day of the Month
1 = 1st Day of the Month

etc.

* = Every  Month
1 = Jan
2 = Feb

etc.

* = Every Day
0 = Sunday
1 = Monday
2 = Tuesday
3 = Wednesday
4 = Thursday
5 = Friday
6 = Saturday

Common examples include…

  minute hour day of month month day of week
To perform a daily task at 2 am 0 2 * * *
To perform a weekly task on Sunday at 2 am 0 2 * * 0
To perform a monthly task on the 1st of each month at 2 am 0 2 1 * *
To perform a task each Tuesday AND Friday at 2 am 0 2 * * 2,5

The following chart indicates what each number or symbol represent.

Please note:

  • Set the cron to perform the task ONLY as frequently as you expect you need the task to be performed.
  • Do NOT set the cron to perform something everyday and that only needs to be done once a month or every other week.  This wastes valuable CPU time for your website and for others.