How to set up cron job in cPanel?

Cron job is a time-based scheduler that allows you to automate certain commands or scripts 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. This article will discuss the proper way on how to set up cron job in cPanel.

Cron Job not working

Many a times, users will place the URL inside the cron job, and always wonder why the cron job does not work. What you may have done is putting just the URL into the cron command, for example:

0 0 * * * http://www.websiteurl.com.sg/pathtoyourfile.php

The above command will not work, because the cron job system will not understand what it is required to do.

Set up cron job in cPanel

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

For example:

0 0 * * * php -q /home/youraccountusername/public_html/pathtoyourfile.php

0 0 * * * wget -q -O/dev/null http://www.websiteurl.com.sg/pathtoyourfile.php

 

Step 1. Login to the cPanel.

cPanel-Login-SS

Step 2. Click on Cron Jobs under Advanced panel.

cronjob1

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.

cronjob3

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.

cronjob2

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.cronjob4

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

cron job in cPanel

(Visited 327 times, 1 visits today)