Cron job is a standard Linux feature used to schedule tasks that the system runs at predefined times or intervals. Typically, a cron job comprises a series of simple tasks that the system runs from a script file.
For instance, you can run a cron job to delete your trash file daily so your website stays updated and cleaned.
cPanel itself uses cron jobs for a host of things, including:
- To run backups
- To clean up log files
- To update itself to the latest version of cPanel
- To ensure the operating system has all its latest updates applied
- To analyse log files and produce statistics and reports
- To perform various daily housekeeping tasks
Cron commands allow one to specify the minute, hour, day of the week, day of the month and month as parameters for when the job should run. All these can be wildcards, allowing for the repeated execution of jobs at regular minute, hour, day, week or monthly intervals.
For example, one can specify the minutes as */5 to run something every 5 minutes.
Cron commands can run anything that can be done on Linux, including running PHP scripts or even sending requests to websites.
Many PHP applications require housekeeping of their own to be done on at least a daily basis, and when you install them, they will ask you to add a cron command to ensure this is done. In addition, applications often use them for invoicing clients, emailing reports or cleaning up old data.