What Are Cron Jobs?
What Is a Cron Job?
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.
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.
Cron Job Limits
Shared and Reseller
- You may NOT run a cron job more often than every 15 minutes.
VPS and Dedicated Server
- You may run a cron job as often as desired.
cURL, GET, and WGET
- cURL, GET and Wget are often used in cron jobs and are enabled on all HostGator servers by default. No further action to activate these functions are necessary. Additional information is available here.
The following articles are for reference only and links will open in a new tab. Please note that HostGator cannot offer direct support for the information provided below.