How to View the Cronjob Hosting Error Log - Hi, Everyone! Remember Cron or Cronjob? Cron or what is often called Cronjob is a utility tool that is used for scheduling systems for shell commands or your website scripts. For those who don't know, you can check the Guide to Setting Cronjob on cPanel . The problem is, does the cron you run actually work properly? Does the cron run have an error? How do I check the error log? Now in the following guide, we will explain how to view the Cronjob error log. So, you can check where the error occurred.

How to View the Cronjob Error Log

Usually the cronjob error log, is not visible. Only the technical team can check. This is of course very troublesome especially for developers. But there is one way you can do it. Namely displaying the cronjob error log to an output file such as a cron.log file. So, you can check whether cron is running properly or not. The result will be similar to the error log in cPanel Hosting. For steps on how to view the cronjob error log, namely:

  1. Login cPanel Hosting

First you have to do is login to cPanel first. To access cPanel, please access the url https://namadomain.com/cpanel . If you are still confused about how to log into cPanel, you can read the previous article about the cPanel Login Guide

 

  1. Create a cron.log file

After that, please create a log output file first. This file was created before you set up the cronjob! To create an output file, please enter the menuFile Manager

 

Then go to the folder public_htmland click Fileto create a new file. In this tutorial, the output file will be namedcron.log

 

  1. Setup the cronjobs

After successfully creating the output file, you have to go back to cPanel Hosting and look for the Cron Jobs Menu in cPanel. Now go ahead and set up the cronjobs you want. To make it easier to find the Cron Jobs menu, you can type "cron" in the search field to bring up the Cron Jobs menu

 

  1. Setting Cron Jobs

In this step, you can set the desired cron command. For example, you want to run a shell command or website script every 5 minutes by displaying the cron log. Then you can enter the settings in the cron command as follows:

 

*/5 * * * * php -q /home/geekwebi/public_html/crontest.php >> /home/geekwebi/public_html/cron.log 2>&1

 

If you have clicked it Add New Cron Jobwill appear below your cron job list as follows:

List of cron job commands

Note:
to geekwebiplease you change to cPanel username respectively. For those of you who are still confused about setting the time on the cron, you can use the Crontab Guru online tool

  1. Check the cron.log file

After the successful setting of the cron command, wait a few minutes to see the results whether the command set appears in the file cron.logor not. If successful, the file cron.logwill display the results of the website script command. As follows,

results from cron.log

Conclusion

By using cronjob, you can create a command that can run automatically and scheduled as you wish. You can follow how to view the cronjob error log by adding the output file command to the cron command. This will make it easier for you to monitor the cron command.

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 best partner

The following are some of our best partners who have worked together on advertising: 401XD Group, KM Panel, MC Project, My Coding, Ilmunesia, Blackexpo Indo, Senja Teduh, Business Media.