A cron job runs a command on a schedule, for example every 5 minutes or every night. Website software uses them for sending emails, clearing caches or running backups.
Add a cron job
- Open your hosting service and, under More tools in cPanel, click Cron jobs.
- Under Add New Cron Job, pick a common setting (such as Once Per Hour) or fill in the minute, hour, day, month and weekday yourself.
- In Command, enter what to run, for example:
/usr/local/bin/php /home/youraccount/public_html/cron.php - Click Add New Cron Job.
Use full paths. Your software's documentation usually gives the exact command.
Stop the emails
By default cron emails you the output of every run. To stop that, add >/dev/null 2>&1 to the end of the command, or clear the Cron Email address at the top of the page.
WordPress tip
WordPress runs its scheduled tasks when someone visits the site, which can be unreliable on quiet sites and slow on busy ones. You can switch that off by adding define('DISABLE_WP_CRON', true); to wp-config.php and adding a real cron job:
/usr/local/bin/php /home/youraccount/public_html/wp-cron.php >/dev/null 2>&1
every 15 minutes.
Be gentle
Running heavy jobs every minute can hit your plan's limits. Most tasks only need to run every 15 minutes or once an hour.