Resync patch with contrib.
[dragonfly.git] / etc / rc.d / sysctl
blobcce967bf0b3f49ffe8ea1cb4dd2cb583cd1f10d7
1 #!/bin/sh
3 # $NetBSD: sysctl,v 1.12 2002/04/29 12:10:23 lukem Exp $
4 # $FreeBSD: src/etc/rc.d/sysctl,v 1.12 2003/04/24 08:20:47 mtm Exp $
5 # $DragonFly: src/etc/rc.d/sysctl,v 1.5 2005/11/19 21:47:32 swildner Exp $
8 # PROVIDE: sysctl
9 # REQUIRE: root
10 # BEFORE: DAEMON
12 . /etc/rc.subr
14 name="sysctl"
15 stop_cmd=":"
16 start_cmd="DragonFly_start"
17 extra_commands="reload lastload"
18 reload_cmd="DragonFly_start"
19 lastload_cmd="DragonFly_start last"
21 DragonFly_start()
24 # Read in /etc/sysctl.conf and set things accordingly
26 if [ -f /etc/sysctl.conf ]; then
27 while read var comments
29 case ${var} in
30 \#*|'')
33 mib=${var%=*}
34 val=${var#*=}
36 if current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then
37 case ${current_value} in
38 ${val})
41 sysctl ${var}
43 esac
44 elif [ "$1" = "last" ]; then
45 warn "sysctl ${mib} does not exist."
48 esac
49 done < /etc/sysctl.conf
54 load_rc_config $name
55 run_rc_command "$1"