Author Topic: Hourly failure emails from anacron SOLVED  (Read 1052 times)

Offline Almost-retired

  • Sr. Member
  • ****
  • Posts: 252
    • What keeps Gene out of the bars
Hourly failure emails from anacron SOLVED
« on: August 07, 2010, 08:03:06 AM »
I finally managed to install sendmail (didn't know it was missing) which didn't fix my 'no mail from the system' problems, but fixing /etc/aliases last line did.

Then I was inundated by such as an hourly anacron failure, the email reading like this:
/etc/cron.hourly/0anacron:
anacron: Can't chdir to /var/lib/spool/anacron: No such file or directory
run-parts: /etc/cron.hourly/0anacron exited with return code 1

Apparently anacron is hard coded to look in /var/LIB/spool/anacron, whereas its files are in /var/spool/anacron.

The cure may be to edit the last line of /etc/cron.hourly/0anacron, adding a -S option:
---------------------------------
#!/bin/bash
#in case file doesn't exist
if test -r /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 -S /var/spool/anacron
--------------------------------------------------------
to tell it where its spool files really are.
One could even call this a broken package I suppose. ;-)
As it now about 2 minutes past thee hour and no new email from there, I believe it is fixed.