xref: /freebsd/libexec/rc/rc.d/sysctl (revision 2e3f49888ec8851bafb22011533217487764fdb0)
1#!/bin/sh
2#
3#
4
5# PROVIDE: sysctl
6
7. /etc/rc.subr
8
9name="sysctl"
10desc="Set sysctl variables from /etc/sysctl.conf and /etc/sysctl.conf.local"
11command="/sbin/sysctl"
12stop_cmd=":"
13start_cmd="sysctl_start"
14reload_cmd="sysctl_start last"
15lastload_cmd="sysctl_start last"
16extra_commands="reload lastload"
17
18sysctl_start()
19{
20	case $1 in
21	last)
22		command_args="-f"
23	;;
24	*)
25		command_args="-i -f"
26	;;
27	esac
28
29	for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
30		if [ -r ${_f} ]; then
31			${command} ${command_args} ${_f} > /dev/null
32		fi
33	done
34}
35
36load_rc_config $name
37run_rc_command "$1"
38