Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
![Reply](https://www.linuxquestions.org/questions/images/buttons/reply.gif) |
11-19-2009, 02:37 PM
|
#1
|
LQ Newbie
Registered: Nov 2009
Posts: 3
Rep:
|
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.
Thanks in advance. ![Smilie](https://www.linuxquestions.org/questions/images/smilies/smile.gif)
|
|
|
11-19-2009, 02:56 PM
|
#2
|
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
|
Hello and welcome to LinuxQuestions,
Can you tell us how you setup the cron job? Using crontab? And next can you verify that the cron daemon is effectively running with the command:
Code:
ps -aux | grep cron
and post the output please?
Also, please post what distro you are using, that could be important to know where files might reside.
Kind regards,
Eric
|
|
|
11-19-2009, 04:07 PM
|
#3
|
LQ Newbie
Registered: Nov 2009
Posts: 3
Original Poster
Rep:
|
Quote:
Originally Posted by EricTRA
Hello and welcome to LinuxQuestions,
Can you tell us how you setup the cron job? Using crontab? And next can you verify that the cron daemon is effectively running with the command:
Code:
ps -aux | grep cron
and post the output please?
Also, please post what distro you are using, that could be important to know where files might reside.
Kind regards,
Eric
|
Set up using craontab, logged in as root.
ps -aux | grep cron
root 17994 0.0 0.1 19664 1132 ? Ss Nov18 0:00 crond
root 15626 0.0 0.0 5920 580 pts/0 S+ 21:02 0:00 grep cron
The distro is CentOS 5.2.
|
|
|
11-19-2009, 04:13 PM
|
#4
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Are you seeing any errors from cron in the logs?
Output from cron in the mailbox of root?
Cheers,
Tink
|
|
|
11-19-2009, 04:14 PM
|
#5
|
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
|
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.
Kind regards,
Eric
|
|
|
11-19-2009, 05:03 PM
|
#6
|
LQ Newbie
Registered: Nov 2009
Posts: 3
Original Poster
Rep:
|
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.
|
|
|
11-20-2009, 01:19 AM
|
#7
|
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
|
Hello,
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.
Kind regards,
Eric
|
|
|
All times are GMT -5. The time now is 02:04 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|