Setting up cron jobs in cPanel

Published 14/04/2014 03.05 PM   |    Updated 26/09/2022 11.29 AM
How do I set up cron jobs in cPanel?

cPanel allows users to create cron jobs in order to run scheduled tasks and scripts.

Difficulty

  • Intermediate

How long will it take me?

  • less than 10 minutes

What will I need?

  • A Fasthosts Dedicated, Virtual, Cloud or CloudNX server with WHM and cPanel.
  • A cPanel username and password set up by your WHM administrator.

Step 1

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

Cron Jobs Icon

Step 2

Scroll down to the Add New Cron Job section. You can either select from the Common Settings drop down menus or fill out your own custom values. Fill out the form as follows:

  • Common Settings: This option allows you to select a preset interval for your cron job to run.

If you have not chosen one of the preset Common Settings, choose from the other options:

  • Minute: Either enter a custom value or select a preset value from the Common Settings menu.
  • Hour: Either enter a custom value or select a preset value from the Common Settings menu.
  • Day: Either enter a custom value or select a preset value from the Common Settings menu.
  • Month: Either enter a custom value or select a preset value from the Common Settings menu.
  • Weekday: Either enter a custom value or select a preset value from the Common Settings menu.

The following example shows a job set up to run twice daily.

Cron Jobs Examples

Step 3

Enter the command you want to run in the Command field and click Add New Cron Job.

The command can be any command able to be run from the Linux terminal. This includes scripts per our example.

Add New Cron Jobs Button

A confirmation will appear to confirm that the job has been added.

Check the cron logs

You can check the logs to confirm whether or not the cron jobs you have set up are running. This can be done in the cPanel terminal.

Step 1

Navigate to Server Configuration and then select Terminal.

Navigate to Server Terminal

Step 2

In the terminal, enter the following command to view the log file for the cron jobs:

tail -f /var/log/cron

This will allow you to confirm the jobs are running as expected

This article was last updated on 26/09/2022 11.29 AM