How to set up a cron job in cPanel
Help centreOn this page
This guide explains how to make the server run a script or command for you on a regular schedule.
Create the cron job
- Log in to cPanel.
- In the Advanced section, click Cron Jobs.
- Under Add New Cron Job, use the Common Settings menu to pick a schedule. This fills in the timing boxes for you.
- In the Command box, enter the command to run. For example, to run a PHP script:
/usr/local/bin/php /home/yourusername/public_html/script.phpReplace yourusername with your cPanel username. - Click Add New Cron Job.
Your job appears in the list further down the page, where you can edit or delete it.
Common timings
The five timing boxes are minute, hour, day, month and weekday. A * means “every”.
| Schedule | Minute | Hour | Day | Month | Weekday |
|---|---|---|---|---|---|
| Every 15 minutes | */15 | * | * | * | * |
| Every hour | 0 | * | * | * | * |
| Every day at 2am | 0 | 2 | * | * | * |
| Every Monday at 9am | 0 | 9 | * | * | 1 |
| First of each month | 0 | 0 | 1 | * | * |
Times use the server clock. Avoid running jobs more often than every five minutes.
Getting the output by email
At the top of the Cron Jobs page there’s a box for an email address. Any output from your jobs is sent there. This is handy while testing.
Once everything works, you can stop the emails by adding this to the end of the command:
>/dev/null 2>&1
If it doesn’t work
- Nothing seems to happen. Add your email address at the top of the page and remove
>/dev/null 2>&1so you can see any errors. - “No such file or directory”. Check the full path to the script. You can find it in File Manager.
- The script runs with the wrong PHP version. Check your settings in how to change your PHP version.
Good to know
WordPress has its own built-in scheduler. Some plugins ask you to replace it with a real cron job for reliability. Follow the plugin’s own instructions for the exact command.
Still stuck? Open a support ticket and we’ll help.
Every plan has cPanel, free SSL, backups every six hours and free migration.