[Updated] As a Unix-like Operating Systems user, you may have used Cron as it is a useful utility. You can use it to schedule commands at a specific time. The schedules commands or tasks are known as Cron Jobs. Cron Jobs is one of the software features of control panels that are also available in the popular cPanel control panel and is using to execute commands at a specific time. To use Cron Jobs, you must copy the desired command to the host and enter its address in the Cron Jobs section. In this article, you will learn How to Enable Cron Jobs on cPanel host. Find your preferred VPS hosting plans and purchase one to be supported by the Eldernode team 24/7.
To let this tutorial work better, please consider the below Prerequisites:
A domain name (www.example.com)
A web hosting account that supports cPanel
cPanel username and password.
Table of Contents
Tutorial Enable Cron Jobs on CPanel
There are three components for most Cron jobs:
1- The script that is to be called or executed.
2- The command that executes the script on a reoccurring basis. This is typically set in cPanel.
3- The action or output of the script, which depends on what the script being called does. While the scripts called Cron jobs would modify files or databases, they are able to perform other tasks that do not modify data on the server as well. (For example: send out email notifications)
What is a Cron Job?
You can use Cron Job to be able to automate commands or scripts on your site. The ”job” is a script that usually performs update tasks such as the list below:
1- Expiring user accounts
2- Sending out automated emails
3- Data visualization
4- Deleting user accounts
5- Updating tables
6- Maintenance tasks
7- Website updates.
How to set up a Cron job on cPanel step by step
Let’s go through the steps of this guide to review set up Cron jobs on cPanel.
First, log in to your cPanel control panel.
Then from the Advanced section, select the Cron jobs option.
In the Cron jobs page, enter the fields in the following order.
3-1 In the first field, you must enter your email to send execution reports after running the script.
3-2 In the common setting section, you must select the time you need to run.
3-3 And in the command section, enter the desired script address.
Note: You can use the following command to enter a command to run a script in the public_html folder.
PHP command examples:
php -q /home/username/public_html/one/cron.php
After entering the required information, click on Add new Cron job.
The intervals for the Cron scheduling can enter in the above corresponding boxes. Here is the explanation of the.
Common Settings – You can use this drop-down list to populate all but the last fields.
Minute – The minute setting for the Cron job.
Hour – The hour setting for the Cron job.
Day – The day setting for the Cron job.
Month – The month setting for the Cron job.
Weekday – The weekday setting for the Cron job.
Command – The Cron job command to execute. If you want to execute a script, then it would look similar to the command below.
After completing the steps, you will see that the desired Cron jobs have been added. You can now schedule a command using the Cron Jobs tool within cPanel.
In this article, you learned How to Enable Cron Jobs on cPanel host. Cron allows you to run scheduled backups, monitor disk space, delete unnecessary files, run system maintenance tasks, and so on. In case you are interested in reading more, find our related articles on cPanel tutorials.