A Cron Job is a scheduled repetitive task, these tasks are set on a time, day or date examples being:
- Every 20 minutes
- Every 24 hours from 3am
- Every 6 days
- First Saturday of month
- First day of the month
From the example you can see that cron jobs can be highly customised and are very useful. When setting the cron job you choose what is executed at the scheduled time frame, mostly it is a script. An example might be at 2am every day run clear_logs.php
A simple guide to cron is:
# ┌───────────── minute (0 - 59) # │ ┌───────────── hour (0 - 23) # │ │ ┌───────────── day of month (1 - 31) # │ │ │ ┌───────────── month (1 - 12) # │ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday; # │ │ │ │ │ 7 is also Sunday on some systems) # │ │ │ │ │ # │ │ │ │ │ # * * * * * command to execute
For a simple cron job generator go here