freebsd-skq/etc/rc.d/sysctl
jilles b69a01f7fa rc.d/sysctl: Fix error messages about unknown OIDs.
There are three situations where the sysctl script is called:
1. "start", very early
2. "lastload", near the end of rc
3. "reload", at admin request while the system is booted

Ignore unknown OIDs in situation 1 because kernel modules may not be loaded
yet and complain about them in situations 2 and 3.

PR:		conf/174595
Submitted by:	Olivier Smedts
2013-03-22 20:12:25 +00:00

36 lines
501 B
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: sysctl
. /etc/rc.subr
name="sysctl"
command="/sbin/sysctl"
stop_cmd=":"
start_cmd="sysctl_start"
reload_cmd="sysctl_start last"
lastload_cmd="sysctl_start last"
extra_commands="reload lastload"
sysctl_start()
{
case $1 in
last)
command_args="-f"
;;
*)
command_args="-i -f"
;;
esac
for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
[ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null
done
}
load_rc_config $name
run_rc_command "$1"