aboutsummaryrefslogtreecommitdiff
path: root/libexec/rc/rc.d/sysctl
diff options
context:
space:
mode:
Diffstat (limited to 'libexec/rc/rc.d/sysctl')
-rwxr-xr-xlibexec/rc/rc.d/sysctl41
1 files changed, 41 insertions, 0 deletions
diff --git a/libexec/rc/rc.d/sysctl b/libexec/rc/rc.d/sysctl
new file mode 100755
index 000000000000..0ca753b530af
--- /dev/null
+++ b/libexec/rc/rc.d/sysctl
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+#
+
+# 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
+
+# doesn't make sense to run in a svcj: config setting
+sysctl_svcj="NO"
+
+run_rc_command "$1"