Scheduling tasks with cron jobs Print

  • cron, cron jobs, scheduled tasks, wp-cron
  • 0

A cron job runs a command or script automatically at set times, for example a daily report, a nightly clean-up or an application's scheduled tasks.

Creating a cron job

  1. In cPanel, open Advanced › Cron Jobs.
  2. Under Add New Cron Job, choose a timing from Common Settings, or fill in the minute, hour, day, month and weekday fields.
  3. Enter the command and click Add New Cron Job.

Example commands

PurposeCommand
Run a PHP script/opt/cpanel/ea-php84/root/usr/bin/php /home/USERNAME/public_html/script.php
Call a web addresscurl -s https://yourdomain.com/cron.php >/dev/null
Run WordPress scheduled taskscd /home/USERNAME/public_html && /opt/cpanel/ea-php84/root/usr/bin/php -q wp-cron.php

Replace USERNAME with your cPanel username, shown on the right of the cPanel home page.

Good practice

  • Do not run jobs more often than needed. Every 15 minutes is enough for almost all websites.
  • Add >/dev/null 2>&1 at the end of a command if you do not want an email every time it runs.
  • Enter your email address under Cron Email to receive any error output.
WordPress: on sites moved during the November 2026 upgrade, WordPress scheduled tasks already run from the server every 15 minutes. You do not need to add a cron job for them.

Was this answer helpful?

« Back