Loading...

Knowledge Base

How to Set Up Cron Jobs in cPanel

Cron Jobs is a cPanel automation tool. It allows you to automate specific commands or scripts on your site. You could set a command or script to run at a particular time every day, week, etc. (for example, set a cron job to delete temporary files weekly to free up disk space).

This guide will provide instructions on how to create, edit, or delete a Cron Job in cPanel.

If you need a different explanation of Cron Jobs, please refer to the Cron Job articles listed below:

How to Create a Cron Job in cPanel

  1. Log in to your Bluehost Account Manager.
  2. Click Hosting in the left-hand menu.
  3. In the hosting details page, click the CPANEL button.

    Bluehost Account Manager - Hosting Tab Details cPanel
     

  4. Your cPanel will open in a new tab.

    Bluehost Account Manager - Hosting Tab - Quick Links - cPanel button - cPanel Dashboard
     

  1. Scroll down to the Advanced section, then select Cron Jobs.
  2. Enter a valid email address in the current email address field and click the Update Email button.

  3. You will then see your cron job scheduling options:
    • Common Settings– Quickly apply standard timing options.
    • Minute – Minute setting for the cron job.
    • Hour – Hour setting for the cron job.
    • Day – Day setting for the cron job.
    • Month – Month setting for the cron job.
    • Weekday – Weekday setting for the cron job.
    • Command – Cron job command to execute. If you want to execute a script, it would look similar to the command below.
    /usr/local/bin/php -c /home/username/public_html/myscript.php
  4. Set the frequency of your Cron Job using the drop-down box for each setting, or use the Common Settings to choose from a list of regularly used intervals. Common Settings include every 15 minutes to once a year.

    Common Settings drop-down

  5. Enter the desired command and click the Add New Cron Job button.

    Field to enter Command and Add New Cron Job button

You have successfully created a Cron Job to execute a file at a specific time and date with the desired repetition.

How to View Existing Cron Jobs in cPanel

The Current Cron Jobs table displays your existing cron jobs.

 

Current Cron Jobs list

How to Edit a Cron Job in cPanel

To edit a cron job, perform the following steps:

  1. Locate the cron job you wish to edit and click the Edit icon.
  2. Edit the settings you want to change and click Edit Line.

How to Delete a Cron Job in cPanel

To delete a cron job, perform the following steps:

  1. Select the Delete button next to the cron job that you wish to delete.
  2. Select the Delete button again to delete it successfully.

The edit panel has fewer common settings, so if you are having trouble getting the correct interval, copy the command, delete the Cron Job, and recreate it using the Add New Cron Job section.

Summary

Learn how to use Cron Jobs in cPanel to automate specific scripts or commands on your website. With Cron Jobs, you can easily schedule a command or script to run at a particular time, day, or week, saving you time and effort. Our guide has step-by-step instructions on how to create, edit, or delete a Cron Job. Also, know the steps to view existing Cron Jobs and edit them if needed. However, it's crucial to learn Linux commands well before using Cron Jobs effectively, and it's always a good idea to check the script with your hosting administrator before using Cron Jobs.

If you need further assistance, feel free to contact us via Chat or Phone:

  • Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
  • Phone Support -
    • US: 888-401-4678
    • International: +1 801-765-9400

You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.

Loading...