Knowledgebase

How to set up a cron job in cPanel

A cron job runs a command or a script automatically at fixed times, for example every hour or every night. Websites use cron jobs for scheduled emails, backups, importing products, or running WordPress tasks on time. This guide shows you how to set up a cron job in cPanel.

Note: running a heavy script too often (every minute) can slow your website and use your account resources. Every 15 minutes or more is enough for most tasks.

1) Open Cron Jobs

In cPanel, go to the Advanced section and click Cron Jobs (1).

Cron Jobs in the Advanced section

2) Add a new cron job

  1. Common Settings (1): choose a ready timing such as Once Per Hour or Once Per Day. The fields below fill automatically.
  2. Or set the time yourself: Minute (2), Hour (3), Day, Month and Weekday.
  3. Command (4): the command to run, for example:
    /usr/local/bin/php /home/USERNAME/public_html/cron.php >/dev/null 2>&1
    Replace USERNAME with your cPanel username. The part >/dev/null 2>&1 stops cPanel from sending you an email every run.
  4. Click Add New Cron Job (5).

Add New Cron Job: common settings, minute, hour, command

Your cron jobs appear in Current Cron Jobs (1), where you can edit or delete them.

Current Cron Jobs list

Useful examples

TaskTimingCommand
WordPress scheduled tasksevery 15 minutes (*/15)/usr/local/bin/php /home/USERNAME/public_html/wp-cron.php >/dev/null 2>&1
Open a URLonce per hourcurl -s https://yourdomain.com/task >/dev/null 2>&1

For WordPress, after adding the cron job add define('DISABLE_WP_CRON', true); to wp-config.php so WordPress stops running cron on every visit. This helps speed: see How to speed up WordPress.

Common problems

  • The cron job does not run → check the full path of the file and of PHP. Test the command by opening the script in the browser if it is a web script.
  • You receive many emails → add >/dev/null 2>&1 at the end, or clear the Cron Email field.
  • Wrong PHP version → use the PHP path of the version you need, or set the version for the domain in MultiPHP Manager.

Frequently asked questions

What does * mean?

"Every". 0 * * * * means minute 0 of every hour; */15 means every 15 minutes.

Which time zone is used?

The server time. If your task must run at an exact Egypt time, tell us and we will confirm the server time zone.

Can a cron job back up my site?

Yes, with a script, but the simplest way is the Backup tool.

Need help? Open a support ticket or message us on WhatsApp +20 127 113 3655.

  • cron jobs, cPanel, automation

Was this answer helpful?

0 Users Found This Useful