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 $
8 # REQUIRE: root modules
14 required_files="/etc/sysctl.conf"
16 start_cmd="sysctl_start"
17 reload_cmd="sysctl_start"
18 lastload_cmd="sysctl_start last"
19 extra_commands="reload lastload"
23 local config extra mib val old_val output
25 if [ ! -f "/etc/sysctl.conf" ]; then
29 # NOTE: Do not miss the last line when it does not end with a LF.
30 while read config extra || [ -n "${config}" ]; do
40 warn "invalid syntax: ${config}"
45 if old_val=$(${SYSCTL_N} -q ${mib}); then
46 debug "sysctl '${mib}': '${old_val}' -> '${val}'"
47 if [ "${old_val}" != "${val}" ]; then
48 output=$(${SYSCTL_W} ${mib}=${val})
51 elif [ "$1" = "last" ]; then
52 warn "sysctl '${mib}' does not exist."
54 done < /etc/sysctl.conf