aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorJuraj Lutter <otis@FreeBSD.org>2024-11-08 13:38:19 +0000
committerJuraj Lutter <otis@FreeBSD.org>2025-02-11 13:47:28 +0000
commit860d98fc6d1237ceea25469a26f7c7cc9c7e4e66 (patch)
tree05d26301f5112a8674b0a93a881deae239e2af75 /usr.sbin
parentcba91bf59c79eadc3b60b83fe2185116496f08fb (diff)
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/periodic/periodic.conf9
-rw-r--r--usr.sbin/periodic/periodic.sh12
2 files changed, 13 insertions, 8 deletions
diff --git a/usr.sbin/periodic/periodic.conf b/usr.sbin/periodic/periodic.conf
index 3bb34d827564..7066c7b49fd1 100644
--- a/usr.sbin/periodic/periodic.conf
+++ b/usr.sbin/periodic/periodic.conf
@@ -15,6 +15,15 @@
#
#
+_set_localbase() {
+ _localbase=`/sbin/sysctl -n user.localbase 2> /dev/null`
+ # Set default value of _localbase if not previously set
+ : ${_localbase:="/usr/local"}
+}
+
+# Set _localbase with fallback to /usr/local
+_set_localbase
+
# What files override these defaults ?
periodic_conf_files="/etc/periodic.conf /etc/periodic.conf.local ${_localbase}/etc/periodic.conf"
diff --git a/usr.sbin/periodic/periodic.sh b/usr.sbin/periodic/periodic.sh
index bb7ecaa01894..61e3022e63aa 100644
--- a/usr.sbin/periodic/periodic.sh
+++ b/usr.sbin/periodic/periodic.sh
@@ -29,14 +29,6 @@ if [ $# -lt 1 ] ; then
usage
fi
-_localbase=`/sbin/sysctl -n user.localbase 2> /dev/null`
-# Set default value of _localbase if not previously set
-: ${_localbase:="/usr/local"}
-
-# 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:${_localbase}/sbin:${_localbase}/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
@@ -44,6 +36,10 @@ if [ -r /etc/defaults/periodic.conf ]; then
source_periodic_confs
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:${_localbase}/sbin:${_localbase}/bin
+
host=`hostname`
export host