How to Create a Cron Job in cPanel


A Cron Job is a scheduled task that runs automatically at a specified time or interval. They are commonly used to automate tasks like sending scheduled emails, clearing cache, running backups, or executing PHP/Python scripts at regular intervals.

Steps to Create a Cron Job

  1. Login to cPanel.
  2. Under the Advanced section, click Cron Jobs.
  3. Scroll down to Add New Cron Job.
  4. Set the schedule using the dropdowns:
    • Minute – When in the hour (0–59)
    • Hour – Which hour (0–23)
    • Day – Day of the month (1–31)
    • Month – Month of the year (1–12)
    • Weekday – Day of the week (0=Sunday, 6=Saturday)
  5. In the Command field, enter the command to run.
  6. Click Add New Cron Job.

Common Cron Job Examples

Run a PHP script every hour:

0 * * * * php /home/username/public_html/cron.php

Run every day at midnight:

0 0 * * * php /home/username/public_html/daily-task.php

Run every 5 minutes:

*/5 * * * * php /home/username/public_html/check.php

Run WordPress WP-Cron manually:

*/15 * * * * php /home/username/public_html/wp-cron.php

Quick Schedule Reference

  • Once Per Minute: * * * * *
  • Once Per Hour: 0 * * * *
  • Once Per Day: 0 0 * * *
  • Once Per Week: 0 0 * * 0
  • Once Per Month: 0 0 1 * *

Tip: Use the full path to your PHP binary and script to avoid "command not found" errors. You can find the PHP path by running which php via SSH.

Editing or Deleting a Cron Job

To edit or remove an existing cron job, go to cPanel → Cron Jobs. Scroll to the Current Cron Jobs section and click Edit or Delete next to the job you want to manage.

If you continue to face issues, please open a create a request.

Ця відповідь Вам допомогла? 0 Користувачі, які знайшли це корисним (0 Голосів)