/etc/periodic question

Matthew Seaman matthew at FreeBSD.org
Fri Jul 22 17:19:48 UTC 2016

On 07/22/16 17:23, Shinnok wrote:
> 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.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20160722/4246a8eb/attachment.sig>

More information about the freebsd-questions mailing list