Setting up cron jobs in cPanel.
Schedule scripts to run automatically — backups, cleanups, batch jobs. Includes safe-defaults and how to debug a cron that doesn't fire.
cron is the unix scheduler. cPanel exposes it via a friendly form. Use it to run scripts on a schedule.
Creating a cron job
- cPanel → Cron Jobs
- Optionally set Cron Email at the top — output of your cron jobs gets emailed here. Leave empty to silence.
- Pick a schedule from the dropdown (Once an hour / Once a day / etc.) or fill the 5 fields manually
- Type the command
- Add New Cron Job
Schedule format
Five fields: minute, hour, day of month, month, day of week.
*/15 * * * * command # every 15 minutes
0 3 * * * command # daily at 3 AM
0 */6 * * * command # every 6 hours
0 0 * * 1 command # Mondays at midnightUse crontab.guru to verify a schedule before saving. Easy to get wrong.
Common commands
WP-CLI cron event runner (replaces WordPress's traffic-triggered cron):
/usr/local/bin/php /home/user/public_html/wp-cron.php > /dev/null 2>&1Custom PHP script:
/usr/local/bin/php /home/user/scripts/cleanup.phpBackup script:
/home/user/scripts/backup.shcurl a URL (for triggering app endpoints):
curl -s "https://yourdomain.com/api/cron/process" > /dev/null> /dev/null 2>&1
These suffix tokens silence stdout (> /dev/null) and stderr (2>&1). Without them, cron emails you the output of every run — gets old fast.
For debugging, leave them off and check email. For production, add them once you trust the job.
PHP version for cron
cron uses the system default PHP, which may differ from your domain's per-domain PHP. To force a specific version:
/opt/cpanel/ea-php83/root/usr/bin/php /home/user/script.phpReplace php83 with the version you want.
WordPress cron — disable WP's built-in trigger
WordPress fires its cron on every page request, which is slow and unreliable. Better:
- Add to
wp-config.php:define('DISABLE_WP_CRON', true); - Set up a real cron job that runs
wp-cron.phpevery 15 minutes
This decouples cron from page traffic. Cron runs reliably even on low-traffic days.
Cron not running — diagnostic
- Check Cron Jobs page — is it listed?
- Set Cron Email at top, save, wait for next scheduled run, check inbox
- If email shows the output, your command works. If silent, your command is failing silently — check paths.
- Test the command manually via SSH first:
If this fails in SSH, it'll fail in cron too. Fix it in SSH, then add to cron./usr/local/bin/php /home/user/script.php
Limits
We allow up to 50 cron jobs per cPanel account. Rate limit is 1 minute minimum interval — schedules like * * * * * (every minute) are fine.
For sub-minute scheduling or job orchestration with retries/dependencies, consider running a small queue worker instead (Beanstalkd, Laravel Horizon, or a Node.js process under Passenger).