PERIODIC(8)
π PERIODIC(8) β the system manager's manual, but make it make sense
okay so bestie, you found the page for periodic, living in section 8 of the system manager's manual. she runs the periodic system functions and honestly? she's the reason your server doesn't spiral. let's get into it π
β¨ NAME β¨
periodic β run periodic system functions
π¦ SYNOPSIS π¦
periodic daily|weekly|monthly|security|directory ...
πΈ DESCRIPTION πΈ
so periodic is this utility that's meant to be called by cron(8) and its whole job is running shell scripts that live in whatever directory you point it at. lowkey the backbone of your whole system's self-care routine π
you must specify one or more of these arguments:
dailyβ performs the standard daily periodic executable run. usually happens early in the morning, local time. literally the sunrise shift πweeklyβ performs the standard weekly periodic executable run. usually very early on Saturday mornings. sorry to your weekend π«Άmonthlyβ performs the standard monthly periodic executable run. usually on the first day of the month. main character energy, first of the month, periodt πsecurityβ performs the standard daily security checks. this is usually spawned by thedailyrun, so it's giving sidekick-but-make-it-important- directory β an arbitrary directory containing a set of executables to be run. go off, pick your own adventure
if an argument is an absolute directory name, it gets used exactly as-is. otherwise it's searched for under /etc/periodic and any other directories specified by the local_periodic setting in periodic.conf(5) (more on that below, keep reading π
).
periodic will run every executable file in the directory or directories you specified. if a file does not have the executable bit set, it's silently ignored. no drama, no error, she just moves on π
each script is required to exit with one of these values, and this part is important so pay attention bestie:
0β the script has produced nothing notable in its output. theβ¨basedirβ©_show_successvariable controls the masking of this output.1β the script has produced some notable information in its output. theβ¨basedirβ©_show_infovariable controls the masking of this output.2β the script has produced some warnings due to invalid configuration settings. theβ¨basedirβ©_show_badconfigvariable controls the masking of this output.>2β the script has produced output that must not be masked. no hiding allowed, it's coming through π₯
if the relevant variable (where β¨basedirβ© is the base directory in which the script resides) is set to βNOβ in periodic.conf, periodic will mask the script output. if the variable is not set to either βYESβ or βNOβ, it gets a default value as described in periodic.conf(5). defaults, iconic behaviour honestly.
all remaining script output is delivered based on the value of the β¨basedirβ©_output setting. so like:
- if it's set to a path name (beginning with a
/character), output is simply logged to that file.newsyslog(8)knows about the files/var/log/daily.log,/var/log/weekly.logand/var/log/monthly.log, and if they exist, it will rotate them at the appropriate times. these are therefore good values if you wish to log periodic output. chef's kiss for logging π - if the
β¨basedirβ©_outputvalue does not begin with a/and is not empty, it's assumed to contain a list of email addresses, and the output is mailed to them. ifβ¨basedirβ©_show_empty_outputis set toβNOβ, then no mail will be sent if the output was empty. no empty-vibe emails, we respect the inbox π - if
β¨basedirβ©_outputis not set or is empty, output is sent to standard output.
π ENVIRONMENT π
periodic sets the PATH environment to include all standard system directories, but no additional directories, such as /usr/local/bin. so if executables are added which depend upon other path components, each executable must be responsible for configuring its own appropriate environment. like, do it yourself bestie, she's not your personal assistant π§
π FILES π
/etc/crontabβ theperiodicutility is typically called via entries in the system defaultcron(8)table/etc/periodicβ the top level directory containingdaily,weekly,monthly, andsecuritysubdirectories which contain standard system periodic executables/etc/defaults/periodic.confβ theperiodic.confsystem registry contains variables that control the behaviour ofperiodicand the standarddaily,weekly,monthly, andsecurityscripts/etc/periodic.conf,${LOCALBASE}/etc/periodic.confβ this file contains local overrides for the default periodic configuration. your personal touches, your signature scent β¨
β EXIT STATUS β
exit status is 0 on success and 1 if the command fails. simple, clean, no notes.
π EXAMPLES π
the system crontab should have entries for periodic similar to the following example:
# do daily/weekly/monthly maintenance
0 2 * * * root periodic daily
0 3 * * 6 root periodic weekly
0 5 1 * * root periodic monthly
the /etc/defaults/periodic.conf system registry will typically have a local_periodic variable reading:
local_periodic="${_localbase}/etc/periodic"
where ${_localbase} is being set from within /usr/sbin/periodic. sneaky but valid π
to log periodic output instead of receiving it as email, add the following lines to /etc/periodic.conf:
daily_output=/var/log/daily.log
weekly_output=/var/log/weekly.log
monthly_output=/var/log/monthly.log
to only see important information from daily periodic jobs, add the following lines to /etc/periodic.conf:
daily_show_success=NO
daily_show_info=NO
daily_show_badconfig=NO
ngl that last one is the vibe check β quiet mode activated π€«
π DIAGNOSTICS π
the command may fail for one of the following reasons:
usage: periodic <directory of files to execute>β no directory path argument was passed toperiodicto specify where the script fragments reside. she's asking nicely, give her a directory π<directory> not foundβ self explanatory. it's not there bestie, look again.
π¦ SEE ALSO π¦
sh(1), crontab(5), periodic.conf(5), cron(8), newsyslog(8)
π₯ HISTORY π₯
the periodic utility first appeared in FreeBSD 3.0. a legend from day one π
π«Ά AUTHORS π«Ά
- Paul Traina
<pst@FreeBSD.org> - Brian Somers
<brian@Awfulhak.org>
π BUGS π
so since one specifies information about a directory using shell variables containing the string β¨basedirβ©, β¨basedirβ© must only contain characters that are valid within a sh(1) variable name β alphanumerics and underscores β and the first character may not be numeric. no cap, keep it clean or it will absolutely break on you π
mwah, that's the whole page bestie β with love from the Debian edition, dated June 18, 2020 π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 1997 FreeBSD, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms