cron is a Linux utility which schedules a command or script on your server to run automatically at a specified time and date. A cron job is the scheduled task itself. Cron jobs can be very useful to automate repetitive tasks.
For example, you can set a cron job to delete temporary files every week to conserve your disk space. Some programs, such as Drupal, may even require you to set up a cron job to perform certain functions.
Scripts executed as a cron job are typically used to modify files or databases. However, they can perform other tasks that do not modify data on the server, like sending out email notifications.
A working knowledge of Linux commands is required to use cron jobs effectively.
Cron jobs can be set to run by the minute, hour, day of the week, day of the month, month or any combination of these.
Cron Job Elements
Most cron jobs include three components:
- The script that is to be called or executed.
- The command that executes the script on a recurring basis (typically set in the cPanel).
- The action or output of the script (which depends on what the script being called does).
Most scripts that require the use of a cron job will give you specific setup instructions. If you are unsure, check with the author of your script before adding a cron job.