freebsd-dev/etc/rc.d/sysctl
Mike Makonnen f2bdfc7dc7 o Rename the start command to conform to rc.d style.
o Move the additional commands list to the end of the
  variable initialization to conform to rc.d style
2004-01-17 11:15:04 +00:00

55 lines
870 B
Bash

#!/bin/sh
#
# $NetBSD: sysctl,v 1.12 2002/04/29 12:10:23 lukem Exp $
# $FreeBSD$
#
# PROVIDE: sysctl
# REQUIRE: root
# BEFORE: DAEMON
# KEYWORD: FreeBSD
. /etc/rc.subr
name="sysctl"
stop_cmd=":"
start_cmd="sysctl_start"
reload_cmd="sysctl_start"
lastload_cmd="sysctl_start last"
extra_commands="reload lastload"
sysctl_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
elif [ "$1" = "last" ]; then
warn "sysctl ${mib} does not exist."
fi
;;
esac
done < /etc/sysctl.conf
fi
}
load_rc_config $name
run_rc_command "$1"