BuycPanel Blog

BuycPanel Blog

Latest news and updates

How to Setup a Cron Job in cPanel

Posted by Allison on 12 07 2017.

Cron jobs are set of codes, tasks or commands that are scheduled to run at a specific or prearranged time and intervals.  A software utility program that runs on Unix and Linux environment called Cron, executes these scheduled script files created in cPanel in order to automate reoccurring tasks that are needed to perform certain functions required by your website.

Setting up a Cron job is essential to the operation of your website because it allows you to perform tasks every minute, hour, day, week, or month without the need of being physically present to operate these commands. A good example of using this feature would be setting up a Cron job that deletes all temporary files every day, in order to free up your server disk space of unnecessary data.
Components of a Cron Job
A Cron job must have the following components present:

 	The script or task to be executed (the…

Cron jobs are set of codes, tasks or commands that are scheduled to run at a specific or prearranged time and intervals.  A software utility program that runs on Unix and Linux environment called Cron, executes these scheduled script files created in cPanel in order to automate reoccurring tasks that are needed to perform certain functions required by your website.

Setting up a Cron job is essential to the operation of your website because it allows you to perform tasks every minute, hour, day, week, or month without the need of being physically present to operate these commands. A good example of using this feature would be setting up a Cron job that deletes all temporary files every day, in order to free up your server disk space of unnecessary data.

Components of a Cron Job

A Cron job must have the following components present:

  1. The script or task to be executed (the command)
  2. The command to execute the job repeatedly (set in cPanel)
  3. The resulting output or action of the script (report sent to the email address set by the user)

Setting up a Cron Job in cPanel

To set up a Cron job in cPanel, all you need to do is follow the simple instructions given below.

Step 1: Login to cPanel

Step 2: In the cPanel Home screen, locate the “Advanced” section

Step 3: In the Advanced section, click on the Cron Jobs Icon

Step 4: In the Cron jobs menu interface, enter the email address where you want the Cron job report to be sent every time the job is executed and click on the “Update email” button

Step 5: In the Command field located at the bottom of the Cron jobs interface screen, enter the command or script that you want the Cron utility to run.

Step 6: After entering the command that you want the Cron utility to run, select how often you wish the script or command is to be executed by filling out the time options settings in the Minute, Hour, Day, Month, and Weekday settings or you can alternatively choose a predefined schedule from the “Common Settings” drop down list.

Step 7: After selecting a schedule for your Cron Job, click on the “Add New Cron job” button in the bottom of the screen to save your settings.

Step 8: After completing the steps above, you now have successfully created your Cron job.

Removing a Cron job

After creating your Cron jobs, time will come that you will no longer need to run these scheduled tasks. To remove or delete a Cron job, do the following steps:

Step 1: In cPanel, access the Cron jobs menu interface

Step 2: In the Cron jobs menu interface, locate the Cron job that you wish to remove or delete

Step 3: Click the “Delete” button next to the Cron job that you wish to delete or remove.

Step 4: After clicking on the Delete button, the selected Cron job will be removed from the list.