How to Set Up a Cron Job in cPanel

January 14, 2021 / cPanel & WHM

A cron job is a helpful process that allows you to automate a number of essential web hosting tasks by setting up a command to run at scheduled intervals. This can include tasks like backing up your website or checking for updates.

Advisory guidance

While setting up a cron job is simple to do, it does require you to have a good knowledge of Linux commands. To avoid problems that can affect your website, we advise customers to check their script with our support team before they create a new cron job.

To set up a cron job, follow these instructions:

1. Log in to cPanel, scroll down to the Advanced section and click the Cron Jobs icon.

2. Option to change notification email address. cPanel will send you an email notification every time the cron job runs. This will help you discover if the cron job fails to run. Your default email is listed in the Cron Email section. If you wish the notification to be sent to a different email address, type that address into the field below and click on the Update Email box.

3. Next, scroll to the Add New Cron Job section.

4. Here, you can set the frequency at which you want the cron job to operate. To simplify the setup, you can either select an option from the Common Settings in the dropdown menus or input your own values.

If you are not familiar with the input values, we recommend only using the common settings.

There is a general Common Settings dropdown at the top (for running jobs once per minute, hour, month, etc.) and common settings for each of the other options. For example, you can choose which time of the day, days of the week, etc. a cron job runs.

The example below shows a cron job set to run on the 1st and 15th days of each month.

Warning: If you run a cron job too frequently, it can reduce the performance of your server. cPanel recommends that you only run cron jobs once per day.

5. Once you have set the frequency of the cron job, the next task is to input the command. Enter this in the Command field.

6. When finished, click the Add New Cron Job button. A confirmation will appear to confirm that the cron job has been added. The cron job will then appear in the Current Cron Jobs section at the bottom of the page and you will receive a notification email every time it runs. 

Spread the love