]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/rc.d/sysctl
Merge branch 'releng/11.3' into releng-CDN/11.3
[FreeBSD/FreeBSD.git] / etc / rc.d / sysctl
1 #!/bin/sh
2 #
3 # $FreeBSD$
4 #
5
6 # PROVIDE: sysctl
7
8 . /etc/rc.subr
9
10 name="sysctl"
11 desc="Set sysctl variables from /etc/sysctl.conf and /etc/sysctl.conf.local"
12 command="/sbin/sysctl"
13 stop_cmd=":"
14 start_cmd="sysctl_start"
15 reload_cmd="sysctl_start last"
16 lastload_cmd="sysctl_start last"
17 extra_commands="reload lastload"
18
19 sysctl_start()
20 {
21         case $1 in
22         last)
23                 command_args="-f"
24         ;;
25         *)
26                 command_args="-i -f"
27         ;;
28         esac
29
30         for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
31                 if [ -r ${_f} ]; then
32                         ${command} ${command_args} ${_f} > /dev/null
33                 fi
34         done
35 }
36
37 load_rc_config $name
38 run_rc_command "$1"