aboutsummaryrefslogtreecommitdiff
path: root/etc/rc.d/sysctl
blob: 11b10ee984de8e8101ecff201a7a1e545cfb78b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: sysctl

. /etc/rc.subr

name="sysctl"
desc="Set sysctl variables from /etc/sysctl.conf and /etc/sysctl.conf.local"
command="/sbin/sysctl"
stop_cmd=":"
start_cmd="sysctl_start"
reload_cmd="sysctl_start last"
lastload_cmd="sysctl_start last"
extra_commands="reload lastload"

sysctl_start()
{
	case $1 in
	last)
		command_args="-f"
	;;
	*)
		command_args="-i -f"
	;;
	esac

	for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
		if [ -r ${_f} ]; then
			${command} ${command_args} ${_f} > /dev/null
		fi
	done
}

load_rc_config $name
run_rc_command "$1"