xref: /freebsd-14.2/libexec/rc/rc.d/sysctl (revision d0b2dbfa)
1*0696600cSBjoern A. Zeeb#!/bin/sh
2*0696600cSBjoern A. Zeeb#
3*0696600cSBjoern A. Zeeb#
4*0696600cSBjoern A. Zeeb
5*0696600cSBjoern A. Zeeb# PROVIDE: sysctl
6*0696600cSBjoern A. Zeeb
7*0696600cSBjoern A. Zeeb. /etc/rc.subr
8*0696600cSBjoern A. Zeeb
9*0696600cSBjoern A. Zeebname="sysctl"
10*0696600cSBjoern A. Zeebdesc="Set sysctl variables from /etc/sysctl.conf and /etc/sysctl.conf.local"
11*0696600cSBjoern A. Zeebcommand="/sbin/sysctl"
12*0696600cSBjoern A. Zeebstop_cmd=":"
13*0696600cSBjoern A. Zeebstart_cmd="sysctl_start"
14*0696600cSBjoern A. Zeebreload_cmd="sysctl_start last"
15*0696600cSBjoern A. Zeeblastload_cmd="sysctl_start last"
16*0696600cSBjoern A. Zeebextra_commands="reload lastload"
17*0696600cSBjoern A. Zeeb
18*0696600cSBjoern A. Zeebsysctl_start()
19*0696600cSBjoern A. Zeeb{
20*0696600cSBjoern A. Zeeb	case $1 in
21*0696600cSBjoern A. Zeeb	last)
22*0696600cSBjoern A. Zeeb		command_args="-f"
23*0696600cSBjoern A. Zeeb	;;
24*0696600cSBjoern A. Zeeb	*)
25*0696600cSBjoern A. Zeeb		command_args="-i -f"
26*0696600cSBjoern A. Zeeb	;;
27*0696600cSBjoern A. Zeeb	esac
28*0696600cSBjoern A. Zeeb
29*0696600cSBjoern A. Zeeb	for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
30*0696600cSBjoern A. Zeeb		if [ -r ${_f} ]; then
31*0696600cSBjoern A. Zeeb			${command} ${command_args} ${_f} > /dev/null
32*0696600cSBjoern A. Zeeb		fi
33*0696600cSBjoern A. Zeeb	done
34*0696600cSBjoern A. Zeeb}
35*0696600cSBjoern A. Zeeb
36*0696600cSBjoern A. Zeebload_rc_config $name
37*0696600cSBjoern A. Zeebrun_rc_command "$1"
38