Newsgroup: it.comp.macintosh
Titolo: Tiger: bug in launchd

Spulciando i log delle routine di manutenzione periodica, mi ero accorto
che qualcosa non andava in launchd, perché spesso le operazioni non
venivano eseguite quando previsto. Ora mi sono fatto un LaunchAgent per
eseguire tutti i giorni un AppleScript e anche questo non va: all'ora
prestabilita la macchina era in stop, e alla successiva riattivazione la
pianificazione non è partita.
In rete in un forum ho trovato questo post di un anno fa:
«There are a couple of problems with periodic tasks at the moment.
Calendar-based periodic tasks (such as the daily, weekly and monthly
scripts, and any similar launch daemons you create yourself) will,
unfortunately, run only once at the scheduled time after the machine
boots, and then not again until another reboot. Plus there's another
issue (see below) regarding their startup possibly being delayed if your
machine has been asleep. The most serious side effect of this is that
the "daily" script will only one once per reboot, not every day.
So for now, adding your tasks to cron in the usual way is the way to go
until this is fixed. Cron still works fine.
Until this launchd issue gets fixed, you probably want to put the
periodic daily/weekly/monthly scripts back into cron the way they were
in Panther, otherwise they won't run when you expect. Add this to
/etc/crontab:
15 3 * * * root periodic daily
30 4 * * 6 root periodic weekly
30 5 1 * * root periodic monthly
I spoke with one of the authors of launchd about these issues- he's not
on this list - and he offered this:
Yes, the calendar based periodic bug is known (4093051) and has a fix
waiting to get approved for a software update. It is obviously an
embarrassing bug that had just the right amount of contributing factors
that lead to it being undetected before we shipped. We are sorry and we
hope to adjust our development process to find bugs like this in the
future. But as you have discovered, we have left cron intact, so that
legacy jobs may be supported.
Modifying the plist that corresponds to cron shouldn't have been
necessary. We do run cron at boot. That is what the "RunAtLoad" flag is
for. I wish I could know why Jerry felt he needed to modify the plist.
"It should just work."
I'm not sure what he means by a "wake event." ...but in any case, there
is another bug (4058640) that he should be aware of when using either of
the interval based launch mechanisms. launchd let's the kernel maintain
all the timers, and as a consequence, any timer bug in the kernel,
therefore affects any program that uses said mechanism (launchd
included). In this case, the kernel will delay a timer from firing the
amount of time that the computer is asleep. Thus, if you sleep your
computer for an hour during the day, and then leave it running
overnight, a job scheduled to fire at 2am will actually run at 3am.
Also, please note, the drift only happens for the amount of time slept
between when the timer was setup and when it goes off next. If the
computer never goes to sleep thereafter, all subsequent alarms will
occur at the correct time.»
Vi risulta che dopo un anno il bug non sia ancora stato corretto...?
-- 
Ci sono 10 tipi di persone: quelle che capiscono il
sistema binario e quelle che non lo capiscono.

 Vi risulta che dopo un anno il bug non sia ancora stato corretto...?
non ti saprei dire... io ho installato la versione per tiger di anacron
e non mi sembra che abbia mai saltato un task... 
-- 
@}-,---',-'----,-'-,-'--,-',---,'--'-,-',- Masque
`, 
http://homepage.mac.com/olistico/
'  

 e non mi sembra che abbia mai saltato un task... 
Ma infatti il merito è di anacron. Comunque anch'io ce l'ho e infatti
spero di aver risolto mettendo il comando dentro /etc/daily.local
anziché nel LaunchAgent di launchd.
