Discussion:
/etc/periodic question
(too old to reply)
Shinnok
2016-07-22 16:23:13 UTC
Permalink
Hi,

Is /etc/periodic daily, weekly, monthly scheduling more like anacron than cron?

Cron will skip a schedule if the system is off or hibernating, whereas anacron will execute with the next opportunity, thus no missed intervals.

If not, then what's the best option for scheduling tasks on non 24hour systems like laptops?

Thanks,
Shinnok
Matthew Seaman
2016-07-22 17:19:37 UTC
Permalink
Post by Shinnok
Is /etc/periodic daily, weekly, monthly scheduling more like anacron
than cron?
Cron will skip a schedule if the system is off or hibernating,
whereas anacron will execute with the next opportunity, thus no
missed intervals.
If not, then what's the best option for scheduling tasks on non
24hour systems like laptops?
It's not just cron-like -- periodic scripts literally are run from the
system crontab file /etc/crontab. That means if your machine is switched
off or hibernating overnight, the default periodic jobs simply won't be run.

There are a few solutions to this you might want to consider:

- change the time that the periodic jobs run to some time when the
machine is more likely to be up. Note that periodic jobs can
involve quite a lot of disk IO, and this may have a noticeable
affect on performance.

- Install anacron from ports and use that instead. Don't forget to
disable the entries in the system crontab, or you'll be bound to
end up with the periodic jobs running twice at some unexpected
time in the future.

- Don't worry about running periodic jobs at all. Periodic jobs are
fairly non-critical and nothing particularly bad will happen if
they aren't run religiously every night, especially on a personal
laptop where there's only one user to worry about and you aren't
modifying the passwd and group files that often. You can achieve
the same results as the periodic scripts by other means where
necessary -- occasionally running the scripts by hand works, and
having comprehensive backups (which you should do in any case)
will be sufficient to replace a number of the periodic jobs.

Cheers,

Matthew

Loading...