UnderHost
Knowledgebase Docs

How to set up cron jobs in cPanel

Schedule automated tasks using cPanel Cron Jobs. Run PHP scripts, WordPress wp-cron, shell commands, and backup scripts on a recurring schedule.

On this page

A cron job is a scheduled command that runs automatically at set intervals. Common uses include sending scheduled emails, clearing cache, running database maintenance, and triggering WordPress scheduled tasks.

Adding a cron job in cPanel

  1. Log in to cPanel
  2. Search for Cron Jobs or find it under Advanced
  3. Set the schedule using the dropdowns (minute, hour, day, month, weekday) or enter cron syntax directly
  4. In the Command field, enter the command to run
  5. Click Add New Cron Job

To receive an email output each time the job runs, set your email in the Cron Email field at the top of the page. Set it to blank or redirect to /dev/null to suppress emails.

Cron schedule syntax

A cron schedule has five fields: minute hour day month weekday

ScheduleCron expression
Every 5 minutes*/5 * * * *
Every hour0 * * * *
Every day at midnight0 0 * * *
Every Monday at 3am0 3 * * 1
First of every month0 0 1 * *

WordPress cron

WordPress has a built-in scheduling system (WP-Cron) that runs when someone visits your site. For sites with low traffic, scheduled tasks may be delayed. Replace WP-Cron with a real cron job:

  1. Add this line to your wp-config.php: define('DISABLE_WP_CRON', true);
  2. Add a cron job in cPanel with the command:
    /usr/local/bin/php /home/cpusername/public_html/wp-cron.php
  3. Set the schedule to */15 * * * * (every 15 minutes is usually sufficient)
Find the PHP path

The PHP binary path may differ by server. Try /usr/local/bin/php first. If the cron does not run, open a support ticket and ask for the correct PHP CLI path for your server.

Troubleshooting

  • Job doesn't run-verify the command path is absolute (starts with /). Relative paths don't work in cron.
  • Permission denied-the script must be executable: chmod +x /path/to/script.sh
  • No output / email-ensure the cron email is set, or redirect output: append >> /tmp/cron-output.log 2>&1 to the command and check the log file
  • Resource usage spikes-avoid running heavy scripts too frequently; see resource limits

Related: Shared hosting overview | Resource limits | Softaculous guide | How to contact UnderHost support

Was this article helpful?

Need shared hosting?

Choose an UnderHost shared hosting plan with cPanel, email, SSL, DNS tools, and 24/7 support.

Related articles

Back to Shared Hosting