This article explains how to use cPanel to configure cron jobs for your website. Cron jobs allow you to set up automated commands that run at intervals you specify, which are perfect for backups, script execution, or routine maintenance.

 

What Is a Cron Job?

A cron job is simply a scheduled task that runs automatically at specific intervals. Example: You can configure a cron job to back up a file every six hours without manual effort.

Adding a Cron Job

  1. Log in to cPanel.

  2. On the Tools page → Advanced section, click Cron Jobs.

  3. Under Cron Email, type the email address where you want to receive notifications, then click Update Email.

    • Every time the cron job runs, you’ll receive a message.

    • To disable notifications, append this to your command:

      >/dev/null 2>&1
      
  4. Under Add New Cron Job, specify the interval for the command you want.

    • Tip: If you select an option under Common Settings, cPanel fills in the values automatically.

  5. In the Command text box, type the command you want to run.

    • Important: Always specify the full path to files in cron jobs.

    • Example:

      /usr/local/bin/php /home/username/my_script.php
      
      Click Add New Cron Job.
    • cPanel creates the cron job.

 

Editing a Cron Job

  1. Log in to cPanel.

  2. Go to Tools → Advanced → Cron Jobs.

  3. Under Current Cron Jobs, click Edit for the job you want to change.

  4. Make your changes, then click Edit Line.

 

Deleting a Cron Job

  1. Log in to cPanel.

  2. Go to Tools → Advanced → Cron Jobs.

  3. Under Current Cron Jobs, click Delete for the job you want to remove.

  4. Confirm deletion.

    • cPanel deletes the cron job.

Notes

  • Cron jobs run based on server time.

  • Incorrect paths or permissions may cause jobs to fail.

  • Avoid scheduling too many jobs at short intervals to prevent server overload.

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

Powered by WHMCompleteSolution