On Thursday 18 August 2005 07:05 pm, Pascal Hakim wrote:
...
> I'm not sure how to deal with this on anacron's side. If people are
> fiddling with the anacron <-> cron interaction, things are going to
> break.
>
> The method you're advocating would result in
> cron.{daily,monthly,weekly}, being run twice if anacron starts before
> cron. Anacron knows the jobs have been run, but cron doesn't.

Good point; but my fix is still an improvement because it (1) reduces the 
anacron <-> cron interaction, and (2) ensures that the jobs DO get done 
(though possibly twice), instead of not running at all.

Furthermore, (3) jobs will be run twice sometimes, but probably not frequently 
(in fact, only when the system has been off --at least during cron's 
worktime-- for a few days in a row, as anacron wouldn't run otherwise), and 
(4) those folks who insist on running both anacron and cron should expect 
having their scripts run twice at times;-) (But folks who have both programs 
installed, but only cron set to run, should not be penalized by never having 
their jobs run, as in the current default setup.)

If you really wanted to avoid running jobs twice, the anacron <-> cron 
interaction would have to increase. One improvement over the current default 
would be to change the lines in /etc/crontab to the following form:

25 6    * * *   root    pidof /usr/sbin/anacron || run-parts 
--report /etc/cron.daily

When cron starts (currently right after anacron starts), it reads this file, 
sees that anacron is running (if pidof returns true), and so skips running 
the scripts. But this is ugly: what if cron starts before anacron? what if 
the anacrontab has been modified to not run the cronjobs, but something else 
instead?

AFAICS, the only elegant solution would be to have timestamps for each job  
(in some standard location), which are checked by both cron and anacron 
before running the job, and are updated whenever the job is run.

--
joel
Life is to you a dashing and bold adventure. --fortune


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

Reply via email to