A Cron Job is a Linux Command for Scheduling a command or script on your server to complete repetitive tasks automatically.
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.
For example, you can set a cron job to delete temporary files every week so that your disk space is not being used up by unnecessary files. Some scripts, such as Wordpress, may even require you to set up a cron job to perform certain functions.
Cron jobs can be a very resourceful tool as they can be set to run by the minute, hour, day of the week, day of the month, month or any combination of these.
What You Should Know Before Using a Cron Job
You should have a working knowledge of Linux Commands before you use cron jobs effectively.
For most cron jobs, there are three components present:
- The script that is to be called or executed
- The command that executes the script on a reccurring 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 instructions on what needs to be set up.