Categories
Linux Commands

Troubleshooting: crontab not running

In Linux-based systems,

crontab

is a well-known job scheduler. You can always use the cron daemon services if you need to conduct specific time-bound functions. What if your crontab stops operating at times? You may confuse yourself while finding out the reason behind this problem. In such a case, you will also try out all of the potential solutions. Please do not go for these options because, in this article, we will provide you some original methods for troubleshooting your crontab. So let’s start this journey!

Why is crontab not working in your system?

Crontab might fail for a variety of reasons:

Troubleshooting crontab:

There are several approaches for troubleshooting crontab in your system, depending upon the actual cause. We will demonstrate to you some of those methods in the upcoming sections.

Is the cron daemon running?

First of all, check out your cron daemon, and it’s working. For that, execute the below-given command and look for cron.

$ pgrep cron

If the output shows you any number that refers to the cron’s main PID, it states that your cron daemon is working fine.

Troubleshooting: crontab not running

Otherwise, utilize the below-given commands for restarting the cron service.

$ sudo service cron start

Troubleshooting: crontab not running

Or:

$ sudo systemctl start cron

Troubleshooting: crontab not running

Now, check out the status of the cron service.

$ sudo systemctl status cron

Troubleshooting: crontab not running

Is cron running your cron job?

Now, have a look at the system log file of your system and check for cron errors.

$ grep CRON /var/log/syslog

This command will show you all the details related to the system log, including the crontab.

Troubleshooting: crontab not running

Raising the cron to debug level:

Another thing you can try out is to raise the cron to debug level. Open up the “/etc/rsyslog.d/50-default.conf”file.

$ nano /etc/rsyslog.d/50-default.conf

Troubleshooting: crontab not running

Comment out the following line in the opened configuration file.

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

Troubleshooting: crontab not running

Write out the below-given command to reload the logger.

$ sudo /etc/init.d/rsyslog restart

After reloading the logger, re-run the cron. Your crontab will work perfectly fine after following this procedure.

Troubleshooting: crontab not running

Conclusion:

Crontab is a popular task scheduler included in the Linux system pack as it schedules a process to execute as root. Ever had an issue while running any job with crontab? If Yes, then Do not worry! This post will rescue you. We have provided different methods for troubleshooting crontab in your system.

Leave a Reply

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