:: Re: [DNG] Crontab depends on Anachr…
Top Pagina
Delete this message
Reply to this message
Auteur: Marjorie Roome
Datum:  
Aan: dng
Onderwerp: Re: [DNG] Crontab depends on Anachron which is not installed by default?

On Sat, 2020-10-10 at 16:35 +0100, g4sra via Dng wrote:
> If anacron is installed, it will check for any outstanding jobs at
> boot and run them.
> [snip]
> Laptops are subject to power management settings which may also stop
> anacron from running.
>

If you use sleep or hibernate these can cause issues for anacron and
the jobs that it schedules (whether on a laptop or desktop,on a server
that runs continuously you wouldn't use anacron).

If you use pm-utils (pm-hibernate, etc). you can stop/start anacron
when you sleep/wake the PC.

I hibernate mine overnight, rather than shut it down. When I wake it
the following day it will then runs anacron. Anacron updates itself to
the current day and then starts the jobs in etc/cron.daily and when
appropriate etc/cron.weekly and /etc/cron/monthly. If I don't enable
this and the default run time for anacron is when I'm sleeping e.g.
05:30 then it will never execute.

Obviously once you'vwe woken it you then need to have the machine stay
awake until the jobs have run.

To get pm-utils to do this create file /usr/lib/pm-utils/95anacron,
with content:

#!/bin/sh

# This script makes anacron jobs stop/start when a workstation
# enters/exits a suspended/hibernated state.
#

case $1 in
    resume|thaw)
    /usr/sbin/invoke-rc.d anacron start >/dev/null   
    ;;
    suspend|hibernate)
    /usr/sbin/invoke-rc.d anacron stop >/dev/null   
    ;;
esac


--
Marjorie