aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2021-12-21 01:08:04 +0000
committerPeter Wemm <peter@FreeBSD.org>2021-12-21 02:54:56 +0000
commit81a48881c63149e5fc104e158ed3d71a2ec659a7 (patch)
tree6c0a04af383593651c9775eeaecc11ec1dede659 /usr.sbin
parent08d157a8321c845dad9f2d6eecea07639a23411a (diff)
downloadsrc-81a48881c63149e5fc104e158ed3d71a2ec659a7.tar.gz
src-81a48881c63149e5fc104e158ed3d71a2ec659a7.zip
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
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/periodic/periodic.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.sbin/periodic/periodic.sh b/usr.sbin/periodic/periodic.sh
index 84e14e9cfd80..26413c4ab51e 100644
--- a/usr.sbin/periodic/periodic.sh
+++ b/usr.sbin/periodic/periodic.sh
@@ -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