Loading...

Knowledge Base

How to Set up Cron Job in cPanel

Cron Job is used to schedule commands at a specific time of the day, week, etc. Cron is generally used for running schedule backupsmonitoring of the disk space, deleting files (like log files) periodically which are no longer required, and running system maintenance tasks.

There are users that will place the URL inside their cron job and wonder why it doesn’t work. Below is a sample of the cron command:

0 0 * * * http://yourdomain.com/pathfile.php

This command will not work, since the cron job system will not understand what it is required to do.

Here are two popular methods of running a cron job via cPanel:

0 0 * * * php -q /home/youraccountusername/public_html/pathtoyourfile.php
0 0 * * * wget -q -O/dev/null http://www.yourdomain.com/pathtoyourfile.php

Below are the steps on how to set up cron job in your cPanel:

Step 1. Log in to the cPanel using this link format: http://yourdomain.com/cpanel/
Replace yourdomain.com with the Main Domain Name connected to your hosting.
Step 2. Click Cron Jobs under Advanced panel.

Step 3. Set up cron job:

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

  • 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 changes.

If you have any further queries, please don’t hesitate to contact our 24/7 Singapore or Australia Support Team.

Did you find this article helpful?

 
* Your feedback is too short

Loading...