How To Set Up Cron Jobs In cPanel


Today websites play an important role in every business sector. Because today it is very easy to showcase your business products and services to the people on the internet if you have a website.  Today if you are looking for the best hosting provider for your website then here at HostingRaja we provide best hosting service at an affordable price. We also cheap cpanel hosting at an affordable price.

 

If you want to get more visitors and customer for your website and for your business then you need to have a dynamic website. So today if you are handling a website and you want it to look dynamic then you can who it by yourself from your cPanel. With the help of Cron jobs, you can have a dynamic website. You can also purchase cpanel web hosting from HostingRaja.

 

A cron is a service which permits the user to automatically execute a script at a specific time. Literally, it contains a series of tasks which the system runs from a script file. Say what you want to set a particular PHP script on your website where it will be automatically executed on your website based on the time that you have set. To execute this PHP script Cron Jobs are used. Cron jobs are scheduled tasks where the system runs at scheduled times or intervals. For example, You can set up a Cron Job to Erase temporary data each and every week so that the  Disk Space which is applied for the temporary data can be erased which will reduce your disk usage. And also in some programs like Drupal, you may need to set up a cron job to perform certain functions in it. You can access the Cron Jobs tool by clicking on the similar icon placed under the Advanced section on the main screen of the Cpanel interface.

Each and every user will have their own crontab, and commands in any given crontab will be executed as the user who owns the crontab. In a cron job, the scripts are used to modify files or databases but they can perform other tasks which do not modify data on the server, Such as sending out email notifications.

Some Benefits of using Cron job:

>>Can be used to build periodic scheduling, and very reliable

>> You can control the minute, hour, day, etc, that it has been executed and can have control over it when it runs

>>Cron job does not occupy memory when it is not running. It occupies memory only when it runs

>>you can easily write the code & you can manage its operation and It eliminates the looping and timing logic so you can run crontab to change the timing or can shut it off.

>>When the Cron job fails and exits for a reason. It will start again when the proper time comes  

>>it very useful when we are performing repetitive tasks

But apart from the benefit of the Cron job, it has a few disadvantages. Cron job will not check for dependencies or other programs or servers, it also will not signal or start downstream dependencies, its child program must re-started  every 120s and also it does not provide tight scheduling constraints(like sub-sec or near real time)

 

Here is the information on how to set up Cron jobs on your website: 

Step 1: Login to cPanel of your account to setup cron job for your account.

Step 2: After login into your account >> under Advanced tab >>  select Cron Jobs. you can also search for cron job using the search box on the top of your C-panel.



Step 3: After you click on Cron jobs you should add registered email ID before going to Cron setting.



Step 4: After you add the  registered email ID >> Go to Add New Cron Job >> Click on Common Settings >> after clicking on Common settings you need to

Common Settings — you need to select a commonly-used interval.  And after this system will configure the appropriate settings in the Minute, Hour, Day, Month, and Weekday text boxes for you.

Minute: Select the Minute when the cron job needs to be runned

Hour: Select the hour when the cron job needs to be runned

Day: Select the Day when the cron job needs to be runned

Month: Select the Month when the cron job needs to be runned

Weekday: Select the day of the week when the cron job needs to be runned



Step 5: After you choose the cron job preferences and give the command >>  Click on Add new Cron job to save the Cron job.




Following the above steps, you can setup Cron Job For your website.

Note:

>> when you entering a path in command which you wish to run make you enter a correct and absolute path Example you want to run analysis.php which us in public_html then you need enter the path: /home/user/public_html/analysis.php

>>It is must the enter settings in common settings, minute, hour, day, month, weekday and command

>> You shouldn’t schedule a cronjob to run often as they might decrease the performance of your website.

>>Do pay full attention when you use the rm command in a cron job you might end up removing the wrong data in the directory.

 

You want to remove the email notification/to disable email notifications for all cron jobs then you to remove the email address.

To view the existing/scheduled cronjobs, go to Current Cron jobs

If you  want to edit the existing cron job follow the steps:

>> locate the cronjob you want to edit in the current cron job and click on edit

>> perform the required changes and click on Edit line  

To delete a cron job, click on Delete next to the cron job which you want o delete, it will be deleted.

If you are facing any issue when you set up Cron jobs on your website you can contact our support team via live chat, email, toll-free or ticket system and our support team is available 24/7 they will be happy to help you with your issue.