Cron job issue - every hour works, but specific hour fails
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Cron job issue - every hour works, but specific hour fails
I've been setting up cron jobs for the first time and have run into a problem.
The following runs every hour at 30 mins past, as it should:
30 * * * * /var/www/log/rotate.sh
But, the following does not run at 30 mins past 7pm, as it should:
30 19 * * * /var/www/log/rotate.sh
The date command displays the date, time, and timezone correctly. But, no matter what hour min combination I try, the cron job doesn't run. However, it will always run with only a min is specified and the other fields are set to first-last.
Any thoughts on what might be causing this? I've searched around, but haven't found anything useful. I'm probably missing something dumb. A solution would be great, but even just a hint to set me in the right direction of what could be going wrong would be great too.
Can you restart the cron daemon and check the log after restarting. Put any relevant info here. I believe the cron log is in /var/log but might be different on CentOS. The only time I noticed this strange behavior is when someone manually edited a crontab file instead of with the crontab command.
Thank you for your replies. The cron log was blank, I checked that it was set up in rsyslog.conf, and it was. I assume that means there were no errors.
Anyway, restarting cron seems to have fixed the issue and I was able to test a specific min and hour job just fine. I'm still very confused why it was an issue in the first place? Afterall, it was running every hour jobs just fine.
Good to hear that it works, though you might keep an eye on it. Could be that just the daemon had a failing child process. If you consider the thread as solved please mark it as such using the thread tools.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.