anacron and cron and laptop usage

Derek Broughton news at pointerstop.ca
Wed Jan 17 17:56:51 UTC 2007


Georg Sauthoff wrote:

> On 2007-01-16, ben darby <ben at cvrse.com> wrote:
> 
>>> Or one could use a cron daemon, where you are able to specify execution
>>> times like '7.30h or first time after that, but only once a day'. If the
>>> daemon uses sleep(3) this behaviour should be trivial to implement.
> 
>> this already exists anacron and what it was specifically designed for,
>> have you read 'man anacron'?
> 
> sure - no offense, but do you have read this thread? Or what passage of
> the man page are you referring to?
> 
> To repeat the issue: I _am_ using anacron. With the default config anacron
> is only started at system startup and at 7:30 AM once a day, but only if
> the computer is running at that time. Thus if you only suspend your
> computer all the time - and it is never online at 7:30 - anacron is
> never ran again. I.e. anacron needs to run at least one time a day.

I confess, I was off the mark first time too.  So my precise solution to
this is to use powersaved (kpowersave, but the same underlying daemon is
used by the gnome version) and set the following:

derek at othello:~$ grep anacron /etc/powersave/sleep
SUSPEND2DISK_RESTART_SERVICES="anacron"

Now, if the machine is up at 7:30, anacron runs the regular cron jobs (that
cron no longer controls), and if it's not, it either runs at next boot
(because anacron's in init.d) or on resume from hibernate (because it's in
powersave).  HTH.
-- 
derek





More information about the ubuntu-users mailing list