In this guide, we will discuss how to set cronjob in cPanel . Have you ever heard the word cronjob before? Maybe many are not familiar with these words, huh. According to Wikipedia , cronjob is a software utility that functions as a scheduling system on a Linux-based computer / server. Yaps, as a scheduling system. What does that mean? That is, you can set the command (shell script) which is executed at a certain time. For example, backing up files every 5 o'clock in the evening, downloading files every 7 o'clock in the morning or sending an email every certain period. So, you don't have to bother running these commands manually one by one.

How to set up Cronjob in cPanel?

So, to do cronjob settings in cPanel, of course, what you have to prepare is hosting and the commands you want to run. For example, you want to download X file every 7 in the morning. This command is often called a script. To be able to write scripts / commands for cronjob, it would be better if you master various Linux commands. This will make it easier for you to write the command you want to schedule. As for how to set cronjob in cPanel, please follow the following step by step,

1. Login cPanel Hosting

The first thing you have to do is login to cPanel first via https: // domainname / cpanel, according to the email sent from KincaiHosting regarding Hosting Account Information. For those of you who don't know how to log in to cPanel,

After that, you will be directed to the KincaiHosting cPanel dashboard page. In the search form, please write "cronjob". Then the Cron Jobs menu will appear in the Advanced section. Please click the Cron Jobs menu.
 

2. Added New Cronjob

Please check the Add New Cron Job column. You can set the time for the script to run periodically. Common Settings are settings / settings that have been set by KincaiHosting by default. At KincaiHosting hosting, the minimum cronjob is every 5 minutes .

However, you can set the time as you wish. For example, once a day, every 5 minutes, twice a day, and so on. So, when you select Once per Day , the script / command will be executed (executed) once a day every 12.00 am

After the time has been added, it is time to write the command so that the script can be executed. First, determine the location of the script to be run. For example, it is located in public_html with the name script.php or script.sh.

  • If the script file is a .php file then the Command column can be written:
 

php -q /home/usercPanel/public_html/script.php >/dev/null 2>&1

  • If the script is a .sh file, then in the Command column you can write:
 

/home/usercPanel/public_html/script.sh >/dev/null 2>&1

After that, click Add New Cron Job. Then a new cronjob will be added
 

How to Change and Delete a Cronjob?

To edit and delete a cron job, please scroll to the bottom of the Current Cron Jobs table. This table contains the cronjob that has been set up regularly on hosting.

To change the cronjob, please click Edit. Then a form will appear as shown below. Change as desired then click Edit Line. To delete a cronjob, just click the Delete button. Then the commands that you have set for a certain time will be deleted.
 

What If the Cronjob Doesn't Work?

If the cronjob that you set doesn't go well, then you can do it edit then add the php version to the command as shown below. For the php version please adjust the php version on the hosting used. For example, if the hosting uses the php 7.2 version, please write it down /usr/local/bin/ea-php72 /home/websites/public_html/script.php >/dev/null 2>&1. After that, don't forget to click Edit Line yes to save the configuration.

 

Closing

Cronjob is a software that makes scheduling easier for you. You can do cronjob settings in cPanel easily. Only need to set the time every how many minutes or every how many hours the command (script) will be executed by the system. Then, the script will run itself periodically. Without having to do it manually. This cronjob is suitable for both hosting and VPS. Want to see Indonesian VPS at low prices but not cheap quality? Please check KincaiHosting's Best VPS . If you have any questions, don't hesitate to contact our Support Team! 😀

What is Safelink Asia?

Safelink.asia is a completely free tool where you can create short links. URL security with cryptographic algorithm. Protect your web visitors with a secure link, to avoid viruses, malware, thief, etc. Apart from being free, you get paid! Register now!


Shorten URLs & earn money

So, now you can make money from home, when managing and protecting your links with Safelink Asia. Signup for an account in just 1 minutes. Once you've completed your registration just start creating short URLs and sharing the links with your family and friends. See our proof of payment and publisher rate.


Our partners and network

Here are some of our partners and networks that have collaborated on advertising: 401XD Group, MC Project, Kincai Media, Kartu Nama Digital, SEO Secret Indonesia, Safelink Asia, Media Bisnis, Blackexpo, Adigunawan.net.