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
This commit is contained in:
Peter Wemm 2021-12-20 17:08:04 -08:00
parent 08d157a832
commit 81a48881c6
No known key found for this signature in database
GPG Key ID: 35D69709EC809E04

View File

@ -30,6 +30,10 @@ if [ $# -lt 1 ] ; then
usage
fi
# Use a deterministic path to match the preset from /etc/crontab in case
# periodic is run interactively.
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
# If possible, check the global system configuration file,
# to see if there are additional dirs to check
if [ -r /etc/defaults/periodic.conf ]; then