Package: cron
Version: 3.0pl1-100
Severity: wishlist
Tags: patch

It's great that cron and anacron work well together, and that
/etc/crontab has code to defer to anacron if anacron is installed.
However, more can be done to make these programs work well
together, and it isn't very hard.

cron generally makes anacron unnecessary on computers that run for
long periods of time without shutting down or restarting. anacron
generally makes cron unnecessary on computers that are never on for
more than 24 hours.

But what about computers that are usually turned off every day, but
sometimes run for several days, or weeks straight? As it is, cron
defers to anacron, which only runs the daily and weekly scripts at
startup, if necessary. This means, that if anacron is installed,
and the user runs his computer for several days, then the daily
jobs don't run. If he runs his computer for several weeks, then
neither the daily nor weekly jobs run, and the monthly jobs might
get behind too.

With my patch, instead of cron just exiting, it calls anacron to do
the work cron would have done. If the daily work has already been
done today, or if the weekly work has already been done in the past
7 days, anacron just exits. However, if the computer has been on
for more than a day, or more than a week, anacron will do it's
jobs, just as if the computer just booted.

The great thing about this patch is that there are no negative effects.
You can run anacron 100 times an hour, and it will not execute its jobs
more often than it is supposed to.

This patch also removes the blank lines at the end. It isn't
necessary, but excessive blank lines are kind of annoying. I don't
know why they are there.

I can't take full credit for this patch. I think I read about it
somewhere online.

Patch:
--- /etc/crontab.old    2007-05-07 02:23:00.000000000 -0700
+++ /etc/crontab        2007-05-07 02:21:47.000000000 -0700
@@ -10,8 +10,9 @@
 # m h dom mon dow user command
 17 *   * * *   root    cd / && run-parts --report /etc/cron.hourly
 25 6   * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts 
--report /etc/cron.daily )
+25 6   * * *   root    test -x /usr/sbin/anacron && anacron
 47 6   * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts 
--report /etc/cron.weekly )
+47 6   * * 7   root    test -x /usr/sbin/anacron && anacron
 52 6   1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts 
--report /etc/cron.monthly )
+52 6   1 * *   root    test -x /usr/sbin/anacron && anacron
 #
-
-


-Brandon



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to