Knowledgebase article

How to set up a cron job in cPanel

A cron job is Romeo's little alarm clock: it runs a task for your website at a set time, every day, every hour, or whenever you like. Use it for sending newsletters, clearing caches, backups or running WordPress tasks on time.

Create a cron job

  1. Log in to cPanel and go to Advanced > Cron Jobs.
  2. (Optional) Under Cron Email, enter an email to receive the output of each run, and click Update Email.
  3. Under Add New Cron Job, choose a timing from Common Settings, for example Once Per Hour or Once Per Day. The minute, hour, day, month and weekday boxes fill in automatically.
  4. In Command, enter what to run (examples below).
  5. Click Add New Cron Job.

Command examples

Run a PHP script:

/usr/local/bin/php /home/cpaneluser/public_html/cron.php

Call a URL:

/usr/bin/curl -s https://yourdomain.com/cron.php > /dev/null 2>&1

Run WordPress's scheduled tasks every 15 minutes (choose Once Per Fifteen Minutes):

/usr/local/bin/php /home/cpaneluser/public_html/wp-cron.php > /dev/null 2>&1

Replace cpaneluser with your cPanel username (shown on the right side of cPanel's home page) and adjust the path.

Romeo's tip: Adding > /dev/null 2>&1 at the end stops cron from emailing you every single time. Leave it off while testing so you can see errors.

Edit or delete a cron job

Scroll to Current Cron Jobs, then click Edit or Delete.

Please be gentle with the server

Running heavy scripts every minute can slow down your account. Every 5 or 15 minutes is enough for most websites.

Was this answer helpful?

Related articles

Still stuck? Romeo's got you.
Our support team replies around the clock, real humans who know your server.