Cron Jobs in cPanel
A cron job in cPanel is a scheduled task that runs a command or script automatically at times you define, without anyone triggering it manually. cPanel's Cron Jobs tool writes the schedule to the hosting account's crontab using standard cron syntax: minute, hour, day of month, month and day of week. It is commonly used for backups, cache clearing, report emails and running a CMS's scheduled tasks reliably.
What a cron job is
Cron is a Linux scheduler that reads a list of rules, each describing a command and when to run it. Every rule has five time fields followed by the command:
| Field | Allowed values |
|---|---|
| Minute | 0 to 59 |
| Hour | 0 to 23 |
| Day of month | 1 to 31 |
| Month | 1 to 12 |
| Day of week | 0 to 6 (0 is Sunday) |
An asterisk (*) in any field means "every value," so * * * * * runs a command every single minute.
Creating a cron job in cPanel
- Log in to cPanel and open Cron Jobs under the Advanced section.
- Under "Add New Cron Job," pick a common setting from the dropdown (such as "Once Per Hour") or choose "Common Settings: Custom" and enter the five fields yourself.
- Enter the command to run, for example a full path to a script or a URL to fetch with curl or wget.
- Click Add New Cron Job to save it.
cPanel also shows an email address field at the top of the page; any output the command produces is emailed there unless you suppress it.
Cron syntax examples
*/5 * * * * Every 5 minutes
0 * * * * Once every hour, on the hour
0 3 * * * Once a day at 3:00 AM
0 3 * * 0 Once a week, Sunday at 3:00 AM
0 0 1 * * Once a month, on the 1st at midnight
Common uses for cron jobs in hosting
- Running a site's scheduled maintenance script instead of relying on a visitor's request to trigger it (an alternative to WordPress's default WP-Cron).
- Taking regular database or file backups.
- Clearing temporary files or caches.
- Sending scheduled reports or digest emails.
- Fetching or syncing data from another system on a timer.
Troubleshooting cron jobs
- Use full paths: cron does not run with your shell's PATH, so write
/usr/local/bin/php /home/user/public_html/script.phprather than justphp script.php. - Check the email output: cPanel emails any text the command prints, including PHP errors, which is the fastest way to see why a job failed.
- Suppress unwanted email by redirecting output, for example adding
>/dev/null 2>&1to the end of the command once it works reliably. - Confirm the schedule matches your expectation by checking the server's timezone, since cron runs on server time, not the visitor's local time.
Frequently asked questions
What is a cron job in cPanel?
It is a scheduled task you create in cPanel's Cron Jobs tool that runs a command or script automatically at set times, without anyone needing to trigger it manually.
How do I add a cron job in cPanel?
Open Cron Jobs under Advanced in cPanel, choose a schedule from the common settings or enter custom minute, hour, day, month and weekday values, enter the command to run, and click Add New Cron Job.
What does */5 * * * * mean in cron?
It means "run every 5 minutes." The */5 in the minute field tells cron to trigger on every minute that is a multiple of 5, and the remaining asterisks mean every hour, day, month and weekday.
Why isn't my cron job running?
The most common reasons are using a relative path instead of a full path to the script or program, a syntax error in the schedule, or a script error you can usually see in the email cPanel sends with the command's output.
Can I run a PHP script with a cron job?
Yes. Point the command to the server's PHP CLI binary followed by the full path to the script, for example /usr/local/bin/php /home/user/public_html/task.php, rather than loading it through a browser URL.
Does cPanel email me the output of cron jobs?
Yes, by default cPanel sends any output the command produces to the email address set on the Cron Jobs page. You can change that address or redirect output to /dev/null to silence it once the job is working.
What is the difference between a cron job and WP-Cron?
WP-Cron is WordPress's own scheduler that only checks for due tasks when a visitor loads a page, which can be unreliable on low-traffic sites. A real cPanel cron job runs on a fixed server schedule regardless of site visits, and is often used to trigger WP-Cron reliably instead.
Related topics
- What Is cPanel? Control Panels
- What Is a Hosting Account? Hosting Basics
- What Is WordPress? WordPress Hosting
- What Is a Database? Databases
- What Is the public_html Folder? FTP & File Management