History log of /freebsd-current/usr.sbin/periodic/periodic.sh
Revision Date Author Comments
# d6251eba 31-Jan-2024 Enji Cooper <ngie@FreeBSD.org>

periodic: fix a typo in a comment

No functional change.


# d0b2dbfa 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line sh pattern

Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/


# e5d7100c 06-Jun-2023 Juraj Lutter <otis@FreeBSD.org>

periodic: Honor kern.localbase

Take kern.localbase into account with fallback to /usr/local and
also allow for LOCALBASE/etc/periodic.conf (similarly to what
many other utilities do).

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D40435
MFC after: 2 weeks


# b45f09ac 28-Feb-2023 Alexander Leidinger <netchild@FreeBSD.org>

periodic: switch lockf to silent operation.

This fixes duplicate mails (one from cron, one from periodic)
when a periodic run is not finished bfore the next one starts.

The man page states that the intended use case is cron, and
the error handling of the lockf invocation handles this case
explicitely, as such no error message for the "interactive"
use was considered.


# 81a48881 20-Dec-2021 Peter Wemm <peter@FreeBSD.org>

periodic: Use a deterministic $PATH for periodic.

Various tools can have alternate versions elsewhere, eg: the GNU
mailutils port (a dependency of emacs*) brings /usr/local/bin/mail.
Match the preset PATH in /etc/crontab for deterministic path searches
even when run manually with a different environment.

PR: 259265
Reported by: iandstanley@gmail.com


# 9809df46 18-Aug-2019 Alan Somers <asomers@FreeBSD.org>

periodic: replace "tty" with "test -t 0"

Apparently using tty for this purpose has been deprecated since 4.4 Lite.

Reviewed by: cy
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D21318


# a9ff79e3 18-Aug-2019 Alan Somers <asomers@FreeBSD.org>

periodic: fix anticongestion for scripts run after security

Revision 316342, which introduced the anticongestion feature, failed to
consider that the periodic scripts are executed by a recursive invocation of
periodic. The recursive invocation wrongly cleaned up a temporary file that
should've been cleaned up only by the original invocation. The result is
that if the first script that requests an anticongestion sleep runs after
the security scripts, the sleep won't happen.

Fix this bug by delaying cleanup until the end of the original invocation.

PR: 236564
Submitted by: Yasuhiro KIMURA <yasu@utahime.org>
Reviewed by: imp
MFC after: 1 month


# 83941043 20-Nov-2017 Alan Somers <asomers@FreeBSD.org>

periodic: fix exit status for nonexistent arguments

When called with an absolute pathname, periodic should attempt to execute
every script in that directory. If the directory does not exist, it should
print an error and exit 1. Due to a copy/paste mistake in r231568, it exits
0 in that case.

Reported by: devel/hs-ShellCheck
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D13070


# 84c8bb4f 20-Jun-2017 Enji Cooper <ngie@FreeBSD.org>

periodic(8): delete trailing whitespace

MFC after: 1 month


# 86571b9c 31-Mar-2017 Alan Somers <asomers@FreeBSD.org>

Consolidate random sleeps in periodic scripts

Multiple periodic scripts sleep for a random amount of time in order to
mitigate the thundering herd problem. This is bad, because the sum of
multiple uniformly distributed random variables approaches a normal
distribution, so the problem isn't mitigated as effectively as it would be
with a single sleep.

This change creates a single configurable anticongestion sleep. periodic
will only sleep if at least one script requires it, and it will never sleep
more than once per invocation. It also won't sleep if periodic was run
interactively, fixing an unrelated longstanding bug.

PR: 217055
PR: 210188
Reviewed by: cy
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D10211


# c5b5b50d 20-May-2016 Alan Somers <asomers@FreeBSD.org>

Better document security_show_{success,info,badconfig} in /etc/periodic.conf

periodic(8) already handles the security_show_{success,info,badconfig}
variables correctly. However, those variables aren't explicitly set in
/etc/defaults/periodic.conf or anywhere else, which suggests to the user
that they shouldn't be used.

etc/defaults/periodic.conf
Explicitly set defaults for security_show_{success,info,badconfig}

usr.sbin/periodic/periodic.sh
Update usage string

usr.sbin/periodic/periodic.8
Minor man page updates

One thing I'm _not_ doing is recommending setting security_output to
/var/log/security.log or adding that file to /etc/newsyslog.conf, because
periodic(8) would create it with default permissions, usually 644, and
that's probably a bad idea.

Reviewed by: brd
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6477


# 94582faa 03-Sep-2013 Jeremie Le Hen <jlh@FreeBSD.org>

Include the calling context in the mail subject, if any.

More concretely, periodic security scripts defaults to being
called from daily ones -- daily context -- so the mail subject
will now be "${HOST} daily security run output" instead of
"{HOST} security run output".

If you switch the period of some security checks to weekly, you
will receive another email "${HOST} weekly security run output".


# 195cf868 25-Aug-2013 Jeremie Le Hen <jlh@FreeBSD.org>

Export a PERIODIC environment variable from periodic(8). This will
allow periodic security scripts to know if they have been called in
a daily or a weekly context.


# df01f319 12-Feb-2012 Brooks Davis <brooks@FreeBSD.org>

Prevent periodic scripts that run longer than the expected period from
starting up before the previous script finishes. This prevents an
infinite number of them from piling up and slowing a system down.

Since all the refactoring to make this happen required churning the
indenting of most of this file, make the indentation more consistent.

Reviewed by: simon
MFC after: 1 week


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 68c35072 22-Jun-2007 David Malone <dwmalone@FreeBSD.org>

Add an option to make periodic(8) quiet when no output was generated.

The man page part of the patch is my fault, the changes to the
periodic script is Dominik's.

PR: 88486
Submitted by: Dominik Brettnacher <domi@saargate.de>
Reviewed by: brian
Approved by: re
MFC after: 1 month


# cb36028e 13-May-2002 Brian Somers <brian@FreeBSD.org>

Mention the ``end of output'' for each periodic script.

Submitted by: David Wolfskill <david@catwhisker.org>
PR: 37036
MFC after: 1 week


# a3125484 25-Nov-2000 Kris Kennaway <kris@FreeBSD.org>

Properly fix the temporary file creation in the case of multiple
command-line arguments.

Noticed by: dynamo <dynamo@ime.net>


# 5542f1c4 01-Nov-2000 Kris Kennaway <kris@FreeBSD.org>

Don't use a trivially predictable temporary filename and keep recreating
it again and again, practically begging the Bad Man to insert his symlink
underneath it and send us down the path to oblivion.

Noticed by: David Lary <dlary@secureworks.net>


# e4b13c6d 20-Sep-2000 Brian Somers <brian@FreeBSD.org>

Fix a typo

Spotted by: Manfred Antar <null@pozo.com>


# df470af5 19-Sep-2000 Brian Somers <brian@FreeBSD.org>

Put temporary output in ${TMPDIR:-/tmp}
If $<basedir>_output is not set, don't redirect output

PR: 21395


# 8a7f44a6 19-Sep-2000 Brian Somers <brian@FreeBSD.org>

Don't clobber $? before using it.

Submitted by: James Barkley <jbarkley@wgate.com>


# 15ef3dc0 16-Sep-2000 Brian Somers <brian@FreeBSD.org>

Fix situations where none of the scripts executed produce output,
so that we don't see any more ``null message body, hope that's
ok'' messages.

We now see something like ``No output from the 3 files processed''.

Lump all output for a given periodic argument together so that
people with /usr/local/etc/periodic/daily (for example) will
get the output of those jobs together with the normal daily run
rather than getting a second email.

Prompted by: ben


# 9ed55d11 14-Sep-2000 Brian Somers <brian@FreeBSD.org>

Another overhaul of the periodic stuff.

All periodic sub-scripts <larf> now have their return codes interpreted
by periodic(8). Output may be masked based on variable values in
periodic.conf.

It's also now possible to email periodic output to arbitrary addresses,
or to send it to a log file, examples of which can be found in
newsyslog.conf.

The upshot of it all should be no discernable changes to the default
behaviour of periodic(8).

PR: 21250


# f3e285ba 22-Jun-2000 Brian Somers <brian@FreeBSD.org>

Introduce /etc/defaults/periodic.conf, similar in concept to rc.conf.
The only change in the default functionality should be that
the output reports are slightly more verbose WRT files deleted.

Not objected to by: freebsd-arch


# b61bde09 27-Apr-2000 Neil Blakey-Milner <nbm@FreeBSD.org>

Update periodic to use the function source_rc_confs that
/etc/defaults/rc.conf now exports.


# 2bed2aa3 29-Mar-2000 Chris Piazza <cpiazza@FreeBSD.org>

export host after setting it.

This is needed so passwd diffs show the hostname instead of
" passwd diffs:"

PR: 17651
Submitted by: Giorgos Keramidas <keramida@ceid.upatras.gr>


# 97d92980 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# f10c8b1a 14-Feb-1999 Jordan K. Hubbard <jkh@FreeBSD.org>

Look in correct rc.conf file.

Submitted by: Kevin Street <street@iname.com


# 54724311 01-Jan-1999 Bill Fumerola <billf@FreeBSD.org>

Make periodic(8) and the security mailings reflect the full FQDN, as opposed
to a hostname. This will help those who keep a cluster of machines all with
the same hostname but different domain names.

PR: bin/9091
Submitted By: Heikki Suonsivu <hsu@clinet.fi>
No Response From: -current mailing list


# 9300774d 29-Dec-1998 Tim Vanderhoek <hoek@FreeBSD.org>

Directories aren't executable.

Submitted by: Dennis Glatting <dennis.glatting@software-munitions.com>
(misc/9147)


# 02eab22c 19-Aug-1997 Paul Traina <pst@FreeBSD.org>

Change local_cron to local_periodic.
Submitted by: bde


# 2a13325f 16-Aug-1997 Paul Traina <pst@FreeBSD.org>

Use /etc/periodic


# a2940c0e 13-Aug-1997 Paul Traina <pst@FreeBSD.org>

Back out the fancy directory sorting, it's more pain that its worth,
and it's there in the CVS repository in case someone things that this
idea is superkeen.


# fb1485d3 13-Aug-1997 Paul Traina <pst@FreeBSD.org>

Incorporate some ideas that came up during discussion with msmith.


# c0fa6e33 12-Aug-1997 Paul Traina <pst@FreeBSD.org>

Initial import of periodic executable control program.