freebsd-dev/sbin/init/rc.d/sysctl
Brad Davis 1135e97b7c Move rc startup scripts from etc/ to sbin/init/
This keeps most startup scripts as CONFS per discussion on src-committers from
back during BSDCan.

Approved by:	will (mentor)
Differential Revision:	https://reviews.freebsd.org/D16466
2018-07-28 20:36:23 +00:00

39 lines
592 B
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: sysctl
. /etc/rc.subr
name="sysctl"
desc="Set sysctl variables from /etc/sysctl.conf and /etc/sysctl.conf.local"
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
if [ -r ${_f} ]; then
${command} ${command_args} ${_f} > /dev/null
fi
done
}
load_rc_config $name
run_rc_command "$1"