"Cron Jobs" is a feature of cPanel that allows you to configure a script for automatic execution for an indefinite period of time. This feature is particularly useful if your website has to perform some automated tasks on a regular basis. Such is the case with most of the Opensource applications used as platforms for building websites. In the next lines of this tutorial, we will show you how to add a new Cron Job and how to manage any already configured such.
As we have mentioned, "Cron Jobs" is a feature of cPanel and to be able to use it you will have to be logged into the cPanel service. Then you will see a complete list of all the features cPanel has to offer. To access the "Cron Jobs" feature, you can either use the search tool provided at the top of the page, or you can look for the "Advanced" features group and within that group, you will see the "Cron Jobs" feature.
Clicking on the feature will take you to the default page of the same. There you will find a brief explanation of what the "Cron Jobs" feature is and also all other tools you will need to manage the "Cron Jobs" of your Web Hosting Account.
By default, the output of the execution for each Cron Job will be sent as an email to the default email address for your Web Hosting Account. If you would like to receive the output on another email account, you will need to configure it in the "Cron Email" section. There, by inputting the email address into the "Email" field and then by pressing the "Update Email" button you will be able to set a new email address for receiving the output from the Cron Jobs executions.
We strongly recommend when configuring the Cron Email to set an email account associated with your Web Hosting Account. You can create a new email account by following our tutorial "How to completely manage Email accounts in cPanel?".
Another thing you should consider is that you can completely disable the emailing of the output from your Cron Jobs execution. To do that, you will need to add the following string at the end of the Command for your Cron Job:
or for example, if the command you would like to execute on a regular basis is:
Then after you add the above mentioned sting at the end the complete command will become:
/usr/local/bin/php /home/hostarma/public_html/script.php >/dev/null 2>&1
As you can see disabling Cron Job output is relatively simple. Now let's add a new Cron Job.
To add a new Cron Job, you will have to scroll down a bit and right after the "Cron Email" section, you will find the "Add New Cron Job" section. There you will be able to fully configure the script you will need to be executed regularly. Let's review the settings you will have to configure:
Once you are ready with the configuration please click on the "Add New Cron Job" button so you can save the configured command.
We recommend configuring a Cron Job for a period not shorter than "Once per five minutes */5 * * * *" or otherwise, depending on the executed command you risk overloading your Web Hosting Account.
Depending on the type of script you would like to execute or more precisely on the used programming language, you will have to configure different commands. For example, if the executed script is PHP based, you will need to add the path to the PHP binary before the path to the executed script:
Here are the paths to the other typically used binaries:
Please note that executing crons for virtual environments is not an available option.
We always advise for testing the command first before adding it as a Cron Job. To do that you will simply need to login over the SSH service for your account and simply paste the whole command in order to review the command's output and the execution.
Once added, the Cron Job will be listed in the next section called "Current Cron Jobs". There you will be able to further manage your existing Cron Jobs.
To Edit an existing Cron Job, please click on the "Edit" link next to every Cron Job on the list. This will bring up an editing interface which is the same as the one you have used when adding the Cron Job, however this time with values already configured.
Once you are done editing the Cron Job, please click on the "Edit Line" button at the bottom of the editing interface.
To Delete an existing Cron Job, please click on the "Delete" link next to the "Edit" link for every Cron Job on the list. This will bring up a confirmation which after confirmed will remove the Cron Job you have chosen.
As you can see adding new Cron Jobs or managing existing ones is not a hard task. Still, if you need any further information on the matter or in case you are facing some sort of difficulty adding new Cron Jobs, please do not hesitate to submit a support ticket and check with our experienced Technical Support Crew since they will be able to assist you with every Cron related issue.
Simeon is an experienced System Administrator with over 10 years of experience in the Web Hosting field. making him recognized as the man behind every technical innovation or improvement that HostArmada introduces. Agile and responsible, he solves every technical issue that we throw at him and even often you will find him publishing technical content on our website.