A cron job is a scheduled task that runs automatically on your server at set intervals — for example, sending a daily report, cleaning up temporary files, or triggering a WordPress task.
How to Create a Cron Job in cPanel
- Log in to cPanel.
- In the Advanced section, click Cron Jobs.
- Under Add New Cron Job, choose a schedule using the Common Settings dropdown (e.g., Once Per Day, Once Per Hour) or enter custom values in the Minute, Hour, Day, Month, and Weekday fields.
- In the Command field, enter the command to run.
- Click Add New Cron Job.
Common Cron Schedule Examples
- Every 5 minutes: */5 * * * *
- Every hour: 0 * * * *
- Every day at midnight: 0 0 * * *
- Every Monday at 8am: 0 8 * * 1
Example: Running a WordPress WP-Cron Command
WordPress relies on a pseudo-cron called WP-Cron to send emails, publish scheduled posts, and run plugins. For reliability, disable the built-in WP-Cron and use a real cron job instead.
Step 1 — Add this to wp-config.php:
define('DISABLE_WP_CRON', true);
Step 2 — Add this cron job in cPanel (every 5 minutes):
*/5 * * * * php /home/cpanelusername/public_html/wp-cron.php > /dev/null 2>&1
Replace cpanelusername with your actual cPanel username and public_html with the correct path if WordPress is in a subdirectory.
How to Find Your Full Server Path
In cPanel File Manager, navigate to your public_html folder. The full path is shown at the top of the File Manager interface (e.g., /home/myusername/public_html).
Receiving Cron Email Notifications
By default, cPanel emails you the output of every cron job. To silence notifications, append > /dev/null 2>&1 to the end of your command.
Note: If your cron job is not running, double-check the server timezone. Hordanso servers typically run on UTC. Adjust your cron time accordingly if you want it to run at a local Nigerian time.
