Bug 507598

Summary: hourly mail to root: "/var/spool/anacron/cron.daily: No such file or directory"
Product: [Fedora] Fedora Reporter: Dennis Jacobfeuerborn <dennisml>
Component: anacronAssignee: Marcela Mašláňová <mmaslano>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 11CC: mike, mmaslano
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: 2009-07-09 11:34:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dennis Jacobfeuerborn 2009-06-23 12:38:11 UTC
Every hour root gets a mail with the following message:

/etc/cron.hourly/0anacron:

cat: /var/spool/anacron/cron.daily: No such file or directory

Yet when I try to look at that file it apparently exists:

[root@nexus ~]# cat /var/spool/anacron/cron.daily 
20090623

Is this some kind of race condition where the file gets deleted/re-created when this cron-job runs? Looking at /etc/anacrontab I can see that anacron is used to run the daily cron-jobs so removing it from the system or disabling is not an option but the constant "You have mail in /var/spool/mail/root" messages I get are somewhat annoying.

Comment 1 Marcela Mašláňová 2009-06-23 13:08:42 UTC
I saw it only once after installation. I'll fix the problem but you have something different. Do you have cronie, crontabs and anacron installed and which versions?

Comment 2 Dennis Jacobfeuerborn 2009-06-23 15:22:16 UTC
[dennis@nexus tripod]$ rpm -q cronie crontabs anacron
cronie-1.3-1.fc11.x86_64
crontabs-1.10-29.fc11.noarch
anacron-2.3-75.fc11.x86_64

This is a fresh F11 install with all updates applied except for 8 pulseaudio packages because audio works with the versions from fedora release but not the ones from the latest updates.

Comment 3 Marcela Mašláňová 2009-06-30 13:08:21 UTC
In case the file /var/spool/anacron/cron.daily exists, it shouldn't be sending emails. At least I can't reproduce this behaviour. The problem of non-existent file should be solved by rewrite of script. 

cat /etc/cron.hourly/0anacron
#!/bin/bash
#in case file doesn't exist
if test -x /var/spool/anacron/cron.daily; then
    day=`cat /var/spool/anacron/cron.daily`
fi
if [ `date +%Y%m%d` = "$day" ]; then
    exit 0;
fi

# in case anacron is already running,
# there will be log (daemon won't be running twice).
if test -x /usr/bin/on_ac_power; then
    /usr/bin/on_ac_power &> /dev/null
    if test $? -eq 1; then
    exit 0
    fi
fi
/usr/sbin/anacron -s

And this should be working for you.