What is a Cron Job?
A Cron Job is a task that runs automatically on your server at defined intervals. It serves purposes such as: sending scheduled emails, cleaning databases, generating reports, synchronizing data, or running the WordPress queue system.
How to create a Cron Job in cPanel
- Log in to cPanel
- Look for the "Advanced" section
- Click on "Cron Jobs"
- In "Add New Cron Job" define the execution interval
- In the "Command" field, type the command to execute
- Click on "Add New Cron Job"
Examples of useful commands
WordPress — Run wp-cron every 5 minutes:
/usr/local/bin/php /home/yourusername/public_html/wp-cron.php
Run a PHP script every hour:
/usr/local/bin/php /home/yourusername/public_html/my-script.php
Configure the time interval
- Every minute:
* * * * * - Every 5 minutes:
*/5 * * * * - Every hour:
0 * * * * - Every day at midnight:
0 0 * * * - Every Monday:
0 0 * * 1
???? Tip: Replace
yourusername with your actual cPanel username. You can find it in the upper right corner of cPanel.