Why is crontab not working in your system?
Crontab might fail for a variety of reasons:
- The first reason is that your cron daemon might not be working for any reason, resulting in your crontab failing.
- There also exists a possibility that your system’s environment variables are not settled correctly.
- Using your Crontab, the script you are trying to execute has some problems or is not executable or restricted.
- The script path you are trying to execute is not correct.
- Using crontab, you are trying to run a file and missing its extension.
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.
If the output shows you any number that refers to the cron’s main PID, it states that your cron daemon is working fine.
Otherwise, utilize the below-given commands for restarting the cron service.
Or:
Now, check out the status of the cron service.
Is cron running your cron job?
Now, have a look at the system log file of your system and check for cron errors.
This command will show you all the details related to the system log, including the crontab.
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.
Comment out the following line in the opened configuration file.
Write out the below-given command to reload the logger.
After reloading the logger, re-run the cron. Your crontab will work perfectly fine after following this procedure.
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.