A cron job is a command the server runs for you on a timetable, for example every 15 minutes or once a day. Websites use cron jobs to send reminder emails, run WordPress scheduled tasks or clear out old files.

Set up a cron job in cPanel

  1. Log in to cPanel at https://cloud.lurstanhost.net:2083.
  2. Under Advanced, open Cron Jobs.
  3. Under Add New Cron Job, pick a time from Common Settings, such as once per fifteen minutes. Or set the minute, hour, day, month and weekday yourself.
  4. Type the command in the Command box.
  5. Select Add New Cron Job. The job appears under Current Cron Jobs, where you can edit or delete it.

Example commands

Run a PHP script:

/usr/local/bin/php /home/USERNAME/public_html/script.php

Replace USERNAME with your cPanel username. The cPanel home page shows your home folder under General Information.

Run WordPress scheduled tasks on a timetable instead of on page visits:

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

Then add define('DISABLE_WP_CRON', true); to your wp-config.php file, so WordPress does not also run them on every visit.

If your script needs a particular PHP version, open a support ticket and we will give you the right command.

Emails from cron jobs

When a job prints anything, the server emails it to the address under Cron Email at the top of the Cron Jobs page. To stop these emails for one job, add >/dev/null 2>&1 to the end of its command.

Good practice

  • Run a job only as often as it needs. Every 15 minutes or once an hour is enough for most websites.
  • A job must finish and stop. Scripts that run all the time are not allowed on shared hosting. See our Acceptable Use Policy.
  • Email sent by a job counts towards the limit of 200 messages an hour for each domain.
Was this answer helpful? 0 Users Found This Useful (0 Votes)