Run a task on a schedule with Cron Jobs
Updated 27 Nov 2026
A cron job runs a command on a timetable, without you being there. Use it to send reminder emails every morning, clear old files every night, or run your app's scheduler every minute.
Create a cron job
- Open Services, choose your hosting and press Login to cPanel.
- Under Advanced, open Cron Jobs.
- Under Cron Email, enter an address and press Update Email. The output of every job is sent there, which helps while testing.
- Under Add New Cron Job, open Common Settings and choose a timetable, for example Once Per Day. The five boxes below fill in by themselves.
- In Command, enter what to run (examples below).
- Press Add New Cron Job.
Reading the timetable
The five boxes are Minute, Hour, Day, Month and Weekday. A * means "every".
| Minute | Hour | Day | Month | Weekday | Runs |
|---|---|---|---|---|---|
*/15 |
* |
* |
* |
* |
every 15 minutes |
0 |
2 |
* |
* |
* |
every night at 02:00 |
30 |
6 |
* |
* |
1 |
every Monday at 06:30 |
0 |
0 |
1 |
* |
* |
the 1st of every month at midnight |
The times follow the server's clock, which may not be Tanzania time. Many servers run on UTC, which is 3 hours behind East Africa Time. If a job runs at the wrong hour, adjust it.
Example commands
Replace cpuser with your cPanel username. You'll find it on the hosting page in the portal and in the right-hand panel of cPanel.
Run a PHP script:
/usr/local/bin/php /home/cpuser/public_html/scripts/reminders.php
/usr/local/bin/php uses your account's default PHP version. To use a specific version, use its full path, for example /opt/cpanel/ea-php82/root/usr/bin/php.
Laravel scheduler (every minute):
/usr/local/bin/php /home/cpuser/laravel-app/artisan schedule:run >/dev/null 2>&1
Open a web address:
wget -q -O /dev/null "https://yourdomain.co.tz/cron.php"
WordPress: a real cron instead of wp-cron
WordPress runs its scheduled tasks only when someone visits. On a quiet site, scheduled posts and shop emails can be late. A real cron job fixes this.
- Add this line to
wp-config.php, above "That's all, stop editing!":
define( 'DISABLE_WP_CRON', true );
- Add a cron job every 15 minutes with:
wget -q -O /dev/null "https://yourdomain.co.tz/wp-cron.php?doing_wp_cron"
Stop the emails
Once a job works, you don't need an email every time it runs. Add this to the end of the command:
>/dev/null 2>&1
Or clear the Cron Email address. To change or remove a job, use Edit or Delete under Current Cron Jobs.
Good habits
- Don't run heavy jobs every minute. Every 5 or 15 minutes is enough for most tasks.
- Test the command first by running it once with the cron email on, and read the output.
- Use full paths for PHP and for your files. Cron doesn't know which folder you mean.
Stuck? Open a ticket and choose Technical. Our team can do it for you. Not hosting with us yet? See our cPanel hosting plans.