Skip to content

Commit

Permalink
set via conf file
Browse files Browse the repository at this point in the history
  • Loading branch information
laffer1 committed Mar 9, 2025
1 parent d62548a commit cbe9a30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
9 changes: 9 additions & 0 deletions usr.sbin/periodic/periodic.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
12 changes: 4 additions & 8 deletions usr.sbin/periodic/periodic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,17 @@ 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
. /etc/defaults/periodic.conf
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

Expand Down

0 comments on commit cbe9a30

Please sign in to comment.