Bug 296741

Summary: anacron + crontabs 1.10-17.fc8: run-parts doesn't execute all cronjobs
Product: [Fedora] Fedora Reporter: Robert Scheck <redhat-bugzilla>
Component: crontabsAssignee: Marcela Mašláňová <mmaslano>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: low    
Version: rawhideCC: jik, wwoods
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-09-25 04:56:11 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 235703, 257221    

Description Robert Scheck 2007-09-19 14:11:43 EDT
Description of problem:
Latest vixie-cron in devel looks *very broken* to me:

Sep 19 19:50:01 tux CROND[32056]: (vnstat) CMD (/usr/sbin/vnstat.cron)
Sep 19 19:50:01 tux CROND[32056]: (vnstat) CMD (/usr/sbin/vnstat.cron)
Sep 19 19:50:01 tux CROND[32056]: (vnstat) CMD (/usr/sbin/vnstat.cron)
Sep 19 20:01:01 tux CROND[768]: (root) CMD (run-parts /etc/cron.hourly)
Sep 19 20:05:01 tux CROND[1326]: (vnstat) CMD (/usr/sbin/vnstat.cron)
Sep 19 20:05:01 tux CROND[1326]: (vnstat) CMD (/usr/sbin/vnstat.cron)
Sep 19 20:05:01 tux CROND[1326]: (vnstat) CMD (/usr/sbin/vnstat.cron)

Why the hell is this executed *three* times in the same second? It's just an 
every 5 minutes cronjob (*/5). So only once per 5 minutes would be enough. 
Unfortunately the cronjob is NOT executed at 20:00:00 - why? Please fix this 
broken things as soon as possible.

It also looks like my logwatch is no longer executed. Logwatch is installed 
correctly and "rpm -V logwatch" returns also nothing. As this worked with 
older versions, something else in vixie-cron must be broken, too.

Version-Release number of selected component (if applicable):
vixie-cron-4.2-2

How reproducible:
Install vixie-cron and vnstat from devel and get some popcorn or cookies when 
watching to /var/log/cron... ;-)

Actual results:
Heavily broken vixie-cron.

Expected results:
Working vixie-cron like in the past (before 4.1-84 or so)
Comment 1 Robert Scheck 2007-09-20 18:14:47 EDT
Looks like cron.hourly, cron.daily, cron.monthly etc. don't work, means that 
they are not executed simply. And the logging behaviour IMHO broke with rsyslog.
Comment 2 Will Woods 2007-09-21 10:46:32 EDT
No, in my testing cron.{hourly,daily,monthly} do get run - sometimes. I have
this in cron.hourly:

#!/bin/sh
touch /tmp/cron-ok
/usr/bin/logger -t crondtest "cron.hourly running OK"
exit 0

I have a /tmp/cron-ok file - but it hasn't been touched in 11 hours (since 23:00
last night). 

The logs are equally strange - I get the log message five times, at 19:00, and
not before or since. 

Further, I installed vnstat, and vnstat runs only at 5 past the hour (instead of
every 5 minutes). However, it *does* run 12 times per hour - just 12 times at once!
Comment 3 Will Woods 2007-09-21 16:19:59 EDT
Okay - figured out why cron.hourly isn't working right. run-parts now has this
at the top:

# if cron.daily was run today
AUX1=`cat /var/spool/anacron/cron.daily`
AUX2=`date +%Y%m%d`
[ "$AUX1" == $AUX2 ] || exit 0

Which means that run-parts silently fails - for *all* cases (hourly, weekly,
etc) - if anacron has run cron.daily today. 

I completely fail to understand why this code is here. It's anacron's job to
figure out if cron.daily has been run already today, not run-parts. Why is that
there?

Removing those four lines should fix cron.hourly, at least.
Comment 4 Will Woods 2007-09-21 17:34:17 EDT
As for the log messages - the vnstat cron is definitely being *run* every 5
minutes, but the log messages have the wrong time and pid on them. That may
actually be just an rsyslog bug. I'll try to investigate further - maybe testing
with a different syslogd would help?
Comment 5 Robert Scheck 2007-09-21 18:46:10 EDT
The run-parts thing was introduced between crontabs-1.10-14 and -16.
Comment 6 Marcela Mašláňová 2007-09-24 06:43:55 EDT
My vnstat is running every five minutes. I'm working on fix of cron.hourly.
Comment 7 Robert Scheck 2007-09-24 06:52:11 EDT
Yes, vnstat is running every five minutes, but logging is broken. As far as I 
can see, it's not only cron.hourly.
Comment 8 Marcela Mašláňová 2007-09-24 09:04:15 EDT
rsyslog has some logging problems. If you run rsyslog with -e it's ok or you can
try syslog-ng instead of rsyslog.
Comment 9 Will Woods 2007-09-24 11:23:00 EDT
*** Bug 303031 has been marked as a duplicate of this bug. ***
Comment 10 Will Woods 2007-09-24 11:31:25 EDT
Bug 303031 was correctly filed against crontabs - changing component here.

I've created a different bug to track the rsyslogd timestamp problem: bug 303341
Comment 11 Marcela Mašláňová 2007-09-25 04:56:11 EDT
Fix in crontabs-1.10-18.fc8 and anacron-2.3-56.fc8. Cron.{hourly,daily,...} run
correct.