cron log location

How to Check Cron Log in Linux

Sometimes you may need to see cron job log in order to check if there are any errors or messages. You may even need to find if crond server is running and all your scheduled tasks are being executed on time. Here are some commonly used commands to check cron log in Linux and find out if crond server is running.


How to Check Cron Log in Linux

Here are some commonly used commands to look at cron service.


Is crond server running

Run any of the following commands to check if crond server is running.

$ sudo service cron status 
$ pgrep cron 
$ sudo status cron
$ ps aux | grep cron 

Also read : How to Install Couchdb in Ubuntu


Where are Cron Logs Located

Cron log files are stored at /var/log/syslog in Ubuntu/Debian systems and at /var/log/cron in Redhat/CentOS systems. Please note, you may need root or sudo privileges to access cron logs.

Ubuntu/Debian

$ sudo grep CRON /var/log/syslog
OR
$ sudo tail /var/log/syslog

Redhat/CentOS

$ sudo grep CRON /var/log/cron
OR
$ sudo tail /var/log/cron

If you don’t find cron logs at above location in Redhat/CentOS system, you may have to enable it as follows. Open /etc/rsyslog.d/50-default.conf

$ sudo vi /etc/rsyslog.d/50-default.conf

Look for the line

#cron.*                          /var/log/cron.log

Uncomment it by removing # at its beginning.

Also read : How to Enable HTTP2 in Tomcat

Restart Cron service.

$ sudo service rsyslog restart
$ sudo service cron restart

That’s it. Now you will find cron logs at /var/log/cron.log location.

Here is a sample output of cron log

Mar 29 16:15:01 data-processing CRON[12624]: (datapro) CMD (/home/script.py)

Also read : How to Run Cron Jobs Every 5, 10, 15 minutes


Leave a Reply

Your email address will not be published. Required fields are marked *