How to set up cron job in cPanel?

  Web Hosting

Cron job is a time-based scheduler that allows you to automate scripts or certain commands on your site at a specific time every day, week, etc.
For example, you could set a cron job to delete temporary files every week to free up disk space or to send  out email reports.

Set up cron job in cPanel

Here are 2 popular methods of running a cron job via cPanel.

Step 1. Login to the cPanel.

Step 2. Click on Cron Jobs under Advanced panel.

Step 3. To set up a cron job:

Common Settings – commonly used time and date interval. The cPanel will give suggestions on what cron job you may want to use.

PHP command examples:

General example:/usr/local/bin/php /home/yourdomain/public_html/path/to/cron/script
Domain-specific example:/usr/local/bin/ea-php56 /home/yourdomain/domain_path/path/to/cron/scriptIn the above example, replace “ea-php56” with the PHP version assigned to the domain you wish to use. Look in the MultiPHP Manager for the actual PHP version assigned to a domain.

Warning: You need to have a good knowledge of Linux commands before you can use cron jobs effectively. Check your script with your hosting administrator before adding a cron job.

 

Minute –  This drop-down menu allows you to select the number of minutes between running the cron job, or the minute each hour on which you wish to run the cron job.
Hour – This drop-down menu allows you to select the number of hours between running the cron job, or the hour each day on which you wish to run the cron job.
Day – This drop-down menu allows you to select the number of days between running the cron job, or the day of the month on which you wish to run the cron job.
Month – This drop-down menu allows you to select the number of months between running the cron job, or the month of the year in which you wish to run the cron job.
Weekday – This drop-down menu allows you to select the day(s) of the week on which you wish to run the cron job.

Note: If you do not wish to receive an email notification of a specific cron job, add the following
line to the command: >/dev/null 2>&1

Step 4. Click Add New Cron Job button to save the changes.

If you have further questions, please do not hesitate to contact our support team.