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
This commit is contained in:
@@ -183,7 +183,7 @@ and the standard
|
|||||||
and
|
and
|
||||||
.Pa security
|
.Pa security
|
||||||
scripts
|
scripts
|
||||||
.It Pa /etc/periodic.conf
|
.It Pa /etc/periodic.conf , ${LOCALBASE}/etc/periodic.conf
|
||||||
this file contains local overrides for the default
|
this file contains local overrides for the default
|
||||||
.Nm
|
.Nm
|
||||||
configuration
|
configuration
|
||||||
@@ -207,7 +207,12 @@ system registry will typically have a
|
|||||||
.Va local_periodic
|
.Va local_periodic
|
||||||
variable reading:
|
variable reading:
|
||||||
.Pp
|
.Pp
|
||||||
.Dl local_periodic="/usr/local/etc/periodic"
|
.Dl local_periodic="${_localbase}/etc/periodic"
|
||||||
|
.Pp
|
||||||
|
where
|
||||||
|
.Pa ${_localbase}
|
||||||
|
is being set from within
|
||||||
|
.Pa /usr/sbin/periodic .
|
||||||
.Pp
|
.Pp
|
||||||
To log
|
To log
|
||||||
.Nm
|
.Nm
|
||||||
|
|||||||
@@ -17,10 +17,10 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# What files override these defaults ?
|
# What files override these defaults ?
|
||||||
periodic_conf_files="/etc/periodic.conf /etc/periodic.conf.local"
|
periodic_conf_files="/etc/periodic.conf /etc/periodic.conf.local ${_localbase}/etc/periodic.conf"
|
||||||
|
|
||||||
# periodic script dirs
|
# periodic script dirs. _localbase is being set in /usr/sbin/periodic
|
||||||
local_periodic="/usr/local/etc/periodic"
|
local_periodic="${_localbase}/etc/periodic"
|
||||||
|
|
||||||
# Max time to sleep to avoid causing congestion on download servers
|
# Max time to sleep to avoid causing congestion on download servers
|
||||||
anticongestion_sleeptime=3600
|
anticongestion_sleeptime=3600
|
||||||
|
|||||||
@@ -30,9 +30,13 @@ if [ $# -lt 1 ] ; then
|
|||||||
usage
|
usage
|
||||||
fi
|
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
|
# Use a deterministic path to match the preset from /etc/crontab in case
|
||||||
# periodic is run interactively.
|
# periodic is run interactively.
|
||||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:${_localbase}/sbin:${_localbase}/bin
|
||||||
|
|
||||||
# If possible, check the global system configuration file,
|
# If possible, check the global system configuration file,
|
||||||
# to see if there are additional dirs to check
|
# to see if there are additional dirs to check
|
||||||
|
|||||||
Reference in New Issue
Block a user