How do I set up Cron Jobs in cPanel?

Cron jobs allow you to automate tasks on your server by scheduling scripts or commands to run at specific times or intervals. This is especially useful for tasks like regular backups, clearing caches, or sending scheduled emails. Follow the steps below to set up a cron job in cPanel.

 

Steps to Set Up a Cron Job in cPanel

 

  1. Log into cPanel:

 

  1. Locate Cron Jobs:
  • Scroll down to the Advanced section.
  • Click on Cron Jobs.

 

  1. Set Up Email Notifications (Optional):
  • If you want to receive an email notification every time the cron job runs, enter your email address in the Cron Email section and click Update Email.
  • If you do not want notifications, simply ensure there is no email set, or add >/dev/null 2>&1 at the end of your cron job command to suppress email output.

 

  1. Add a New Cron Job:
  • In the Add New Cron Job section, you’ll see a dropdown menu for Common Settings. Here, you can choose a predefined interval for your cron job (e.g., once per day, every minute, every week).
  • Alternatively, you can manually set the schedule using the fields provided for Minute, Hour, Day, Month, and Weekday. For example:
    • */5 * * * * – This will run the job every 5 minutes.

 

  1. Enter the Command to Run:
  • In the Command field, enter the command or script you want to run. This can be a PHP script, shell script, or another command. Example:
     /usr/local/bin/php /home/yourusername/public_html/cron.php

Replace /home/yourusername/public_html/cron.php with the actual path to your script.

 

  1. Click Add New Cron Job:
  • Once you’ve set the timing and command, click Add New Cron Job to save your new cron task.

 

If you need further assistance, feel free to contact our support team.

  • 0 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Relaterede artikler

Why can't I log into my cPanel or webmail?

cPanel access issues can be caused by two things, your firewall or our firewall/brute force...

How do I reduce the number of inodes I'm using?

What is an inode?An inode is a data structure used to keep information about a file on your...

How do I view my website statistics in cPanel?

AWstats is a popular server log analyser included with cPanel. It can be used to generate a wide...

Where do I go to login to my cPanel?

Once you're logged into your client account, in the navy blue menu bar on top, click on...