Cron Jobs

In the Advanced section of icons, the Cron jobs link allows you to automate website script tasks. This is quite possibly one of the most misunderstood and yet most powerful features of cPanel.

WordPress is a great example of cron jobs. WordPress has a cron job system that will automate specific tasks on a website (like future scheduled posts, for example).

If you have ever used WordPress before and noticed that some of those automated features didn't work as expected (especially the timing of the automatic updates), it was because of the cron job.

When WordPress has a visitor to the site, it will look to see if the cron job needs to be called, but if your site doesn't receive daily traffic, then the cron job may not get called at all!

You can correct this by simply adding a real cron job entry in your cPanel for the WordPress cron job.

The first thing you need to know is the location of the Home Directory of your site. In cPanel, towards the bottom of the left-hand column, you can find some information for your hosting account that includes the Home Directory (as shown below).

Take note of this Home Directory because you will need it to create the cron job.

Now, click on the Cron Jobs link to get started. You will want to use the Add New Cron Job section at the top of that page.

You can specify the timing of the cron job here. For the WordPress cron job, you will want it to run once an hour - this can be selected from the Common Settings drop-down box.

Once you select that setting, the only other thing you need to do is provide the command for the cron job.

For the WordPress cron job, we want to run a PHP file once an hour. To do this, simply use the php command followed by the full directory path to the file that you want to run.

Below, you can see the cron job that I created, which shows the full path to the WordPress cron job for this site. Notice the Home Directory at the beginning of the path, followed by public_html. After that, I have also used the directory for an addon domain on this account, downcomforterguide.com. Finally, I have specified the cron job file wp-cron.php. That file is located in the home directory of any WordPress site - you just need to figure out the full directory path to get to it to add it as a cron job.


© cPanel Training Guide

>>> Back to TABLE OF CONTENTS <<<
Category: Article | Added by: Marsipan (21.08.2014)
Views: 372 | Rating: 0.0/0
Total comments: 0
avatar