How can you Configure CRON Jobs?
Posted by Allura on 25 10 2018.
This feature is for cPanel and WHM version 64. One can navigate to (Home >> Advanced >> Cron Jobs) to work on this feature.
These are scheduled tasks which the system runs at already defined times or intervals. Usually, a cron job will contain a series of simple tasks which the system will run from a script file.
It is to note that if one schedules cron jobs to run too often, then they might degrade the server’s performance.
Add a Cron Job Email
The Cron Email section allows to enter an email address for the system to send notifications when the cron jobs run.
- One needs to enter the email address at which the user wants to receive the notifications in the Email text box.
- Then one can click on Update Email.
Add a Cron Job
- Firstly, one needs to select the interval at which the cron job will run from the appropriate menus, or can even enter the values in the text boxes.
- Common Settings — Allows one to select a commonly-used interval. The system will thereafter configure the appropriate settings in the Minute, Hour, Day, Month, and Weekday text boxes.
- Minute — Used in order to select the number of minutes between each cron job running time, or the minute of each hour based on which the cron job will run.
- Hour — Used in order to select the number of hours between each cron job running time, or the hour of each day to run the cron job.
- Day — Used in order to select the number of days between each cron job running time, or the day of the month to run the cron job.
- Month — Used in order to select the number of months between each cron job running time, or the month of the year to run the cron job.
- Weekday — Used in order to select the days of the week to run the cron job.
- One can enter the command in order to run the system in the Command text box.
In order to run the public_html/index.php file in the home directory, one needs to enter the following command:
In order to disable notifications for a specific cron job, one can add the following line to the command:
It is important to specify settings for the Minute, Hour, Day, Month, Weekday, and Command text boxes and one must be cautious while using the rm command in a cron job. One’s home directory’s data might get deleted if one does not declare the correct options.
- Lastly, one can click on Add New Cron Job.
This feature helps in containing simple tasks which the system will run from a script file with certain technical steps.