Skip to main content

Setting Up a Cron Job in cPanel

In this guide we will show how to configure cron job in cPanel

Updated yesterday

0. Prerequisites

  1. WHM/cPanel is installed on your server. You can follow our guide to install it;

  2. Created cPanel user. You can create it by following this tutorial.

Please note: Make sure you understand Linux commands before using cron jobs. It is best to verify your script with your server administrator first.

1. Open "Cron Jobs" management page

In your cPanel, under "Advanced" section, click on"Cron Jobs":

2. Configure Email

On next page, add the email address where you want to receive the cron job output each time it runs:

Click "Update Email" to save changes.

3. Set when the cron job should run

Choose how often the cron job should run by selecting an option from the Common Settings menu or by entering a custom schedule.

Selecting a common setting automatically fills in all fields except the Command field

In this screenshot, the Twice Per Day preset is selected. This cron job is set to run twice per day, at 12:00 AM and 12:00 PM, every day of the month, every month, regardless of the weekday:

• Minute 0 means it runs at the very start of the hour

• Hour 0,12 means midnight and noon

• Day * means every day

• Month * means every month

• Weekday * means every day of the week

If you want to manually set the timing fields to control exactly when the cron job runs, select in each field:


• Minute
• Hour
• Day
• Month
• Weekday

If you want, use * to mean “every”.

Example:
Runs every day at midnight
Minute: 0
Hour: 0
Day: *
Month: *
Weekday: *

This schedule runs the cron job once per day at exactly midnight, regardless of the date, month, or day of the week.

4. Enter your command

In the Command field, enter the full command for the script you want to run, including the path from root. Then click "Add New Cron Job":

Click "Add New Cron job" to save changes.

If there are no errors, the cron job is active immediately.

5. Review your cron job

Once added, the cron job appears at the bottom of the page under "Current Cron Jobs":

You can click "Edit" to make adjustments to your cron job (for example change timing or edit command:

You can click "Delete" if you no longer need the cron job and want to remove it.

Did this answer your question?