What is cron? It is the scheduling daemon of the Linux operating system
Cron jobs allow you to automate repetitive tasks on the server that hosts your web site. This is a powerful tool that allows you to take a hands-free approach to repetitive tasks.
There are two different modes you can use to add a cron job:
Standard – Provides a range of pre-set options that you can choose. This is the simplest method and is recommended.
Advanced (Unix Style) – Provides the regular Unix style cron options. Recommended for users who are used to this method of entering cron entries.
To add or modify a cron job:
Click on the Cron jobs button on the home page.
If you want to use the Standard mode, click on the Standard button.
Enter the e-mail address to send the results of running the cron job in the top field.
Enter the command the you want to run in the Command to run field.
Click on one option from each of the available lists.
Click on the Save Crontab button. Your cron job has now been added or updated.
Note: You can always click on the Reset Changes button to change the cron job back to whatever it was before you started entering information.
If you want to use the Advanced mode, click on the Advanced (Unix Style) button.
Enter the cron job script in the Command field.
Click on the Commit Changes button. Your cron job has now been added or updated.
Your changes will be stored on /var/spool/cron/<user>
Edit Root Crontab entries
root@cpanel# crontab -e
View Root Crontab entries
root@cpanel# crontab -l Linux Crontab Format
MIN HOUR DOM MON DOW CMD
Field Description Allowed Value MIN Minute field 0 to 59 HOUR Hour field 0 to 23 DOM Day of Month 1-31 MON Month field 1-12 DOW Day Of Week 0-6 CMD Command Any command to be executed
Directories, Files and Locations used in cron
/etc/crontab file lists the times to run various cron directories with any files.
/etc/cron.hourly directory listing of hourly files to be run
/etc/cron.daily directory listing of daily files to be run
/etc/cron.weekly directory listing of weekly files to be run
/etc/cron.monthly directory listing of monthly files to be run
/etc/cron.allow file list of users allowed to use crontab (not always present)
/etc/cron.deny file list of users denied to use crontab (not always present)
Example cPanel knowledgebase cron jobs
0 11,16 * * * /home/cpanelkb/public_html/cronjob.php
0 – 0th Minute (Top of the hour)
11,16 – 11 AM and 4 PM
* – Every day
* – Every month
* – Every day of the week