Cron jobs let you run scripts automatically on a schedule β for example, sending daily reports, clearing caches, or running backups. This guide explains how to set up cron jobs in cPanel.
What is a Cron Job?
A cron job is a scheduled task that runs a script at specific intervals β every minute, hour, day, week, or month. Common uses include WordPress scheduled tasks, automated emails, and database maintenance.
Adding a Cron Job in cPanel
Go to Advanced > Cron Jobs. Under Add New Cron Job, either use the common settings dropdown (e.g., Once Per Day) or enter a custom schedule. In the Command field, enter the full path to your script:
/usr/local/bin/php /home/username/public_html/myscript.php Understanding Cron Syntax
The schedule uses 5 fields: minute hour day month weekday. Examples:
0 0 * * *β every day at midnight*/15 * * * *β every 15 minutes0 9 * * 1β every Monday at 9:00 AM
WordPress Cron
WordPress uses a "virtual" cron triggered by visitors. For more reliable scheduling, disable WP-Cron and use a real cron job instead:
- Add
define('DISABLE_WP_CRON', true);towp-config.php - Create a cron job:
*/15 * * * * /usr/local/bin/php /home/username/public_html/wp-cron.php