blob: 623956d63b1d19cbd290822a7c3ad796d9b791c9 (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: sysctl
# REQUIRE: root
# BEFORE: DAEMON
. /etc/rc.subr
name="sysctl"
stop_cmd=":"
start_cmd="sysctl_start"
reload_cmd="sysctl_start"
lastload_cmd="sysctl_start last"
extra_commands="reload lastload"
#
# Read in a file containing sysctl settings and set things accordingly.
#
parse_file()
{
if [ -f $1 ]; then
while read var comments
do
case ${var} in
\#*|'')
;;
*)
mib=${var%=*}
val=${var#*=}
if current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then
case ${current_value} in
${val})
;;
*)
sysctl "${var}"
;;
esac
elif [ "$2" = "last" ]; then
warn "sysctl ${mib} does not exist."
fi
;;
esac
done < $1
fi
}
sysctl_start()
{
parse_file /etc/sysctl.conf $1
parse_file /etc/sysctl.conf.local $1
}
load_rc_config $name
run_rc_command "$1"
|