What is a Cron Job?
Cron jobs are scheduled assignments that the system runs at predefined times. These can be set to launch every half hour, minute, or day after the month, quarter, or week of the year.
Special attention should be paid while deciding the course of action of Cron jobs to avoid duplication.
For instance, the launch of Cron jobs is scheduled at every 10 minutes but the time taken to perform that activity at one time is 15 minutes. It will result in the beginning of second job whilst the first has not been done yet. This could lead to the slowness in the website and inefficient performance.
The following steps should be performed to set up Cron jobs in Cpanel:-
1- Login to the Cpanel
2- Click the Cron Jobs icon
3-Now enter the email address where you want the cron jobs to be launched at specific intervals
4-Now you have to define exactly when and how often you want the cron job to run. You can choose here the time at which you want the cron jobs to run. ( For example- a 1minute, half-hour, etc.)
5-After choosing the time, Click on Add Cron Job.
6- Next, enter the command of the script you want to run, including the path (from root). If you are on shared hosting - add nice -n 15 to the start.
7-When ready, click Add New Cron Job
That's all! The cron job has been set. You can create additional cron jobs, and edit or delete existing ones.