LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 11-19-2009, 01:37 PM   #1
lunarleviathan
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Rep: Reputation: 0
Unhappy 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.
 
Old 11-19-2009, 01:56 PM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
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
 
Old 11-19-2009, 03:07 PM   #3
lunarleviathan
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by EricTRA View Post
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.
 
Old 11-19-2009, 03:13 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Are you seeing any errors from cron in the logs?
Output from cron in the mailbox of root?



Cheers,
Tink
 
Old 11-19-2009, 03:14 PM   #5
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
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
 
Old 11-19-2009, 04:03 PM   #6
lunarleviathan
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 0
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.
 
Old 11-20-2009, 12:19 AM   #7
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell prompt works, cron job fails btuley Linux - General 1 11-13-2008 11:40 AM
NTP cron job runs every 5 min instead of hour OlRoy Linux - Networking 17 02-28-2008 10:51 AM
Aergh. X dies on the hour, every hour l00zer Linux - Software 4 06-07-2005 10:02 PM
change clock from 24 hour to 12 hour in suse 9.2/KDE 3.3 jmlumpkin Linux - Newbie 1 01-22-2005 11:45 PM
cron job to send file via ftp every 1 hour mcalizo Linux - Newbie 1 07-14-2004 03:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration