1999-03-28 20:36:03 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-07-18 05:00:17 +00:00
|
|
|
# $NetBSD: sysctl,v 1.12 2002/04/29 12:10:23 lukem Exp $
|
1999-08-27 23:37:10 +00:00
|
|
|
# $FreeBSD$
|
2000-10-08 19:20:36 +00:00
|
|
|
#
|
|
|
|
|
2002-07-18 05:00:17 +00:00
|
|
|
# PROVIDE: sysctl
|
2003-04-24 08:20:47 +00:00
|
|
|
# REQUIRE: root
|
2002-07-18 05:00:17 +00:00
|
|
|
# BEFORE: DAEMON
|
|
|
|
# KEYWORD: FreeBSD NetBSD
|
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="sysctl"
|
|
|
|
stop_cmd=":"
|
|
|
|
|
2002-09-06 16:18:05 +00:00
|
|
|
case ${OSTYPE} in
|
2002-07-18 05:00:17 +00:00
|
|
|
FreeBSD)
|
|
|
|
start_cmd="FreeBSD_start"
|
|
|
|
extra_commands="reload lastload"
|
|
|
|
reload_cmd="FreeBSD_start"
|
|
|
|
lastload_cmd="FreeBSD_start last"
|
|
|
|
;;
|
|
|
|
NetBSD)
|
|
|
|
start_cmd="NetBSD_start"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
FreeBSD_start()
|
|
|
|
{
|
|
|
|
#
|
|
|
|
# Read in /etc/sysctl.conf and set things accordingly
|
|
|
|
#
|
|
|
|
if [ -f /etc/sysctl.conf ]; 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
|
2002-10-25 23:02:54 +00:00
|
|
|
elif [ "$1" = "last" ]; then
|
|
|
|
warn "sysctl ${mib} does not exist."
|
2002-07-18 05:00:17 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done < /etc/sysctl.conf
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
NetBSD_start()
|
|
|
|
{
|
|
|
|
if [ -r /etc/sysctl.conf ]; then
|
|
|
|
echo "Setting sysctl variables:"
|
|
|
|
${SYSCTL} -f /etc/sysctl.conf
|
|
|
|
fi
|
|
|
|
}
|
2000-08-09 02:03:30 +00:00
|
|
|
|
2002-07-18 05:00:17 +00:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|