FreeBSD periodic scripts

Written by Kirill Filatov, on 31 January 2025.
Tags: #freebsd #bsd

General info

For me periodic is a quintessence of Unix philosophy.

It’s a shell script running from cron (see /etc/crontab for getting precise timing ) which runs another shell scripts which do one small job. Periodic looks at executable files at /etc/periodic/(daily|weekly|monthly|security) and runs them according to timetable.

You can find timestamps of periodic startups at /var/log/cron.

Configuration defaults are set at /etc/default/periodic.conf. If you need customisation write your config overrides at /etc/periodic.conf of /etc/periodic.conf.local. Scripts are located at /etc/periodic dir. There are plenty of scripts of different purposes such as backup, security checks and so on.

Must have for daily system administration.

Change *.output to email address instead of “root” or forward your local root mail if you don’t want to read it localy. You can place needed mail address at /etc/mail/aliases like this:

root: me@my.domain

By the way /etc/mail/aliases is backuped by one of the default periodic scripts :-)

Bonus

Setup regular zfs snapshots

pkg install zfsnap

echo 'daily_zfsnap_enable = "YES"' >> /etc/periodic.conf.local

https://klarasystems.com/articles/freebsd-periodic-scripts/