sysctl revision 92516
145096Simp#!/bin/sh 245096Simp# 366830Sobrien# Copyright (c) 1999 Warner Losh 466830Sobrien# All rights reserved. 545096Simp# 666830Sobrien# Redistribution and use in source and binary forms, with or without 766830Sobrien# modification, are permitted provided that the following conditions 866830Sobrien# are met: 966830Sobrien# 1. Redistributions of source code must retain the above copyright 1066830Sobrien# notice, this list of conditions and the following disclaimer. 1166830Sobrien# 2. Redistributions in binary form must reproduce the above copyright 1266830Sobrien# notice, this list of conditions and the following disclaimer in the 1366830Sobrien# documentation and/or other materials provided with the distribution. 1466830Sobrien# 1566830Sobrien# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1666830Sobrien# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1766830Sobrien# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1866830Sobrien# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1966830Sobrien# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2066830Sobrien# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2166830Sobrien# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2266830Sobrien# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2366830Sobrien# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2466830Sobrien# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2566830Sobrien# SUCH DAMAGE. 2666830Sobrien# 2750472Speter# $FreeBSD: head/etc/rc.d/sysctl 92516 2002-03-17 20:14:11Z dougb $ 2866830Sobrien# 2964446Schris 3066830Sobrien# 3166830Sobrien# Read in /etc/sysctl.conf and set things accordingly 3266830Sobrien# 3366830Sobrien 3445096Simpif [ -f /etc/sysctl.conf ]; then 3564446Schris while read var comments 3645096Simp do 3764446Schris case ${var} in 3864446Schris \#*|'') 3964446Schris ;; 4064446Schris *) 4192516Sdougb mib=${var%=*} 4292516Sdougb val=${var#*=} 4392516Sdougb 4492516Sdougb if current_value=`sysctl -n ${mib} 2>/dev/null`; then 4592516Sdougb case ${current_value} in 4692516Sdougb ${val}) ;; 4792516Sdougb *) 4892516Sdougb sysctl ${var} 4992516Sdougb ;; 5092516Sdougb esac 5192516Sdougb else 5292516Sdougb case ${1} in 5392516Sdougb last) 5492516Sdougb echo "Warning: sysctl ${mib} does not exist" 5592516Sdougb ;; 5692516Sdougb esac 5792516Sdougb fi 5864446Schris ;; 5964446Schris esac 6064446Schris done < /etc/sysctl.conf 6145096Simpfi 62