Cron Jobs in cPanel
Cron jobs allow you to schedule commands or scripts to run automatically at specified intervals.
Creating a Cron Job
- Log in to cPanel
- Go to Advanced section
- Click Cron Jobs
- Set the schedule using the time fields:
Minute 0-59 Hour 0-23 Day 1-31 Month 1-12 Weekday 0-6 (0=Sunday) - Enter the command
- Click Add New Cron Job
Common Examples
# Run every hour\n0 * * * * /usr/local/bin/php /home/user/public_html/cron.php\n\n# Run daily at midnight\n0 0 * * * /usr/local/bin/php /home/user/script.php\n\n# Run every 5 minutes\n*/5 * * * * /usr/local/bin/php /home/user/check.php
Email Notifications
Set the Cron Email at the top of the page to receive output from your cron jobs. To suppress emails, append > /dev/null 2>&1 to the command.
WordPress Cron
For better WordPress performance, disable WP-Cron in wp-config.php:define('DISABLE_WP_CRON', true);
Then set a real cron job to run wp-cron.php every 5 minutes.