]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/kfreebsd/files/procps.init
4ecb6010f4640e680b5be3cdbe57f3bd859b7267
[dsa-puppet.git] / modules / kfreebsd / files / procps.init
1 #! /bin/sh
2 # /etc/init.d/procps: Set kernel variables from /etc/sysctl.conf
3 #
4 # written by Stephen Gran <sgran@debian.org> based on work by Elrond <Elrond@Wunder-Nett.org>
5
6 ### BEGIN INIT INFO
7 # Provides:          procps
8 # Required-Start:    mountkernfs $local_fs
9 # Required-Stop:
10 # Default-Start:     S
11 # Default-Stop:
12 # Short-Description: Configure kernel parameters at boottime
13 # Description:  Loads kernel parameters that are specified in /etc/sysctl.conf
14 ### END INIT INFO
15
16 PATH=/sbin:/bin
17
18 SYSCTL=/bin/sysctl
19
20 test -x $SYSCTL || exit 0
21
22 . /lib/lsb/init-functions
23
24 # Comment this out for sysctl to print every item changed
25 QUIET_SYSCTL="-q"
26
27 # Check for existance of the default file
28 if [ -f /etc/default/rcS ] ; then
29   . /etc/default/rcS
30 fi
31
32 set -e
33
34 VERBOSE=yes
35 case "$1" in
36         start|restart|force-reload)
37                 log_action_begin_msg "Setting kernel variables "
38                 STATUS=0
39                 for file in /etc/sysctl.conf /etc/sysctl.d/*.conf ; do
40                         if [ -r "$file" ] ; then
41                                 if [ "$VERBOSE" = "yes" ] ; then
42                                         log_action_cont_msg " $file"
43                                 fi
44                                 egrep -v '^[[:space:]]*(#|$)' "$file" | while read line; do 
45                                         $SYSCTL $QUIET_SYSCTL "$(echo $line | sed -e 's/ = /=/')"
46                                 done
47                         fi
48                 done
49                 log_action_end_msg $STATUS
50                 ;;
51         stop)
52                 ;;
53         *)
54                 echo "Usage: /etc/init.d/procps {start|stop|restart|force-reload}" >&2
55                 exit 3
56                 ;;
57 esac
58
59 exit 0
60