[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#29786: Two related Bugs: Early morning, slow computer.



Package: anacron
Version: 2.0.1-2

I have a debian 2.0 system on a i386 box (AMD K6, to be precise).

I think I've found a sizeable bug in /etc/init.d/anacron:

>     # Run anacron only if it's later than 7:30am.
>     if test `date +%H%M` -lt 730; then
>         exit 0
>     fi

If I switch on my computer each morning at 2 am and power it
down again at 4 am, the scripts in
/etc/cron.(daily|weekly|monthly) will simply never run.

If I analyzed the situation correctly.  I didn't experience
the bug myself (yet).  I actually do consider having my
computer run from a automated power supply time switch for
an hour or so each night, to do certain communication tricks
for me.



There's a second, related bug that takes more time to explain:

I have my PC running when I use it, sometimes a few hours,
sometimes only a few minuts.  I switch off power when I
don't need it.

My computer appearently thinks I shouldn't be so
conservative with energy: I'm occasionally having problems
with my PC's hardware clock.  It sometimes stops ticking
and, upon booting, shows a time close to when I last
switched off power.

So I sigh and set the system and hardware clock.


Fairly frequently, I soon afterwards get a lot of noisy
activity from my hard disk (lots of seeks).

A while ago, I realized that updatedb was involved, so I
moved the file "find" from /etc/cron.daily to
/etc/cron.weekly.  That helped some.

The other Sunday night, after I had again had to pull my
system clock up for several hours, there again was this
noisy hard disk activity.  I investigated with "ps fax" and
found that updatedb was running - _twice_ at the same time!
Once under cron, and also (simultaniously) under anacron.

Two (/usr/bin/)find processes simultaniously digging through
all my files.  No wonder I got all this noise!

If I analysed this situation correctly, there is an
assumption buildt into the system: Namely, that the 0anacron
script in each /etc/cron.(daily|weekly|monthly) directory
runs so quickly, it will have finished before the activity
from /etc/cron.d/anacron file starts.

Personally, I deeply mistrust all assumptions how quickly
things run. - Even on a Debian GNU Linux system. :-)

As happened to me, setting the system clock may ruin this
particular assumption.  Other circumstances might, too.
E.g., /usr/sbin/anacron might be on a network (NFS) drive
that becomes unavailable for a few hours (NFS mount option
"hard").


I think both bugs can be cleaned up as follows:

If anacron is installed, it alone runs the
/etc/cron.(daily|weekly|monthly) scripts.  Plain cron, if
also installed, does not run those scripts directly, but
through /etc/cron.d/anacron only.

This makes unneccessary any time restrictions in
/etc/init.d/anacron.  (I assume that anacron has some
build-in locking facility, so that two anacron processes
won't be running (the same commands) simultaniously.)

Those /etc/cron.(daily|weekly|monthly)/0anacron scripts
become unneccessary and can be removed.

Yours

Andreas Krüger


Reply to: