aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>1999-12-28 06:11:06 +0000
committerBill Nottingham <notting@redhat.com>1999-12-28 06:11:06 +0000
commit7d302ba296c897e3770de1ee968ab9eb4c963491 (patch)
treef23633a04f84a8876e7a1a4961d628a995c69be2 /rc.d
parentd65f430d850549092ca90e784e753a3f76227c69 (diff)
downloadinitscripts-7d302ba296c897e3770de1ee968ab9eb4c963491.tar
initscripts-7d302ba296c897e3770de1ee968ab9eb4c963491.tar.gz
initscripts-7d302ba296c897e3770de1ee968ab9eb4c963491.tar.bz2
initscripts-7d302ba296c897e3770de1ee968ab9eb4c963491.tar.xz
initscripts-7d302ba296c897e3770de1ee968ab9eb4c963491.zip
switch from echoing values into /proc/sys to using sysctl
Diffstat (limited to 'rc.d')
-rwxr-xr-xrc.d/init.d/network61
-rwxr-xr-xrc.d/init.d/single2
-rwxr-xr-xrc.d/rc.sysinit19
3 files changed, 9 insertions, 73 deletions
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index d623d01c..8747cc65 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -43,64 +43,9 @@ for inter in `ls ifcfg* | egrep -v '(ifcfg-lo|:)' | egrep 'ifcfg-[a-z0-9]+$'`; d
[ -n "$int" ] && interfaces_boot="$interfaces_boot $int"
done
-ipv4_forward_set ()
-{
- # Turn IP forwarding on or off. We do this before bringing up the
- # interfaces to make sure we don't forward when we shouldn't, and
- # we do it even if networking isn't configured (why not?).
- if [ -d /proc/sys/net/ipv4 ]; then
- # people could have left this out of their kernel, which isn't
- # exactly an error
- if [ ! -f /proc/sys/net/ipv4/ip_forward ] ; then
- echo "/proc/sys/net/ipv4/ip_forward is missing --" \
- "cannot control IP forwarding" >&2
- else
- if [ "$FORWARD_IPV4" = "no" -o "$FORWARD_IPV4" = "false" ]; then
- value=0
- message="Disabling IPv4 packet forwarding"
- else
- value=1
- message="Enabling IPv4 packet forwarding"
- fi
-
- if [ $value != `cat /proc/sys/net/ipv4/ip_forward` ]; then
- action "$message" /bin/true
- echo "$value" > /proc/sys/net/ipv4/ip_forward
- fi
- fi
- fi
-}
-
-ipv4_defrag_set ()
-{
- # Sets whether or not to always defrag packets.
- # Good for masquerading. Not so good otherwise.
- if [ -d /proc/sys/net/ipv4 ]; then
- if [ ! -f /proc/sys/net/ipv4/ip_always_defrag ]; then
- echo "/proc/sys/net/ipv4/ip_always_defrag is missing --" \
- "cannot control IP defragmentation" >&2
- else
- if [ "$DEFRAG_IPV4" = "yes" -o "$DEFRAG_IPV4" = "true" ]; then
- value=1
- message="Enabling IPv4 automatic defragmentation"
- else
- value=0
- message="Disabling IPv4 automatic defragmentation"
- fi
-
- if [ $value != `cat /proc/sys/net/ipv4/ip_always_defrag` ]; then
- action "$message" /bin/true
- echo "$value" > /proc/sys/net/ipv4/ip_always_defrag
- fi
- fi
- fi
-}
-
# See how we were called.
case "$1" in
start)
- ipv4_forward_set
- ipv4_defrag_set
action "Bringing up interface lo" ./ifup ifcfg-lo
@@ -142,14 +87,12 @@ case "$1" in
if [ -d /proc/sys/net/ipv4 ]; then
if [ -f /proc/sys/net/ipv4/ip_forward ]; then
if [ `cat /proc/sys/net/ipv4/ip_forward` != 0 ]; then
- action "Disabling IPv4 packet forwarding" /bin/true
- echo 0 > /proc/sys/net/ipv4/ip_forward
+ action "Disabling IPv4 packet forwarding" sysctl -w net.ipv4.ip_forward=0
fi
fi
if [ -f /proc/sys/net/ipv4/ip_always_defrag ]; then
if [ `cat /proc/sys/net/ipv4/ip_always_defrag` != 0 ]; then
- action "Disabling IPv4 automatic defragmentation" /bin/true
- echo 0 > /proc/sys/net/ipv4/ip_always_defrag
+ action "Disabling IPv4 automatic defragmentation" sysctl -w net.ipv4.ip_always_defrag=0
fi
fi
fi
diff --git a/rc.d/init.d/single b/rc.d/init.d/single
index 0bcb9dab..4bf94387 100755
--- a/rc.d/init.d/single
+++ b/rc.d/init.d/single
@@ -31,7 +31,7 @@ rm -f /var/lock/subsys/*
# make sure modprobe is working
if [ -f /proc/sys/kernel/modprobe ]; then
- echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
+ sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
fi
# If they want to run something in single user mode, might as well run it...
diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit
index 1e2b3220..c4852c2d 100755
--- a/rc.d/rc.sysinit
+++ b/rc.d/rc.sysinit
@@ -44,23 +44,15 @@ fi
action "Mounting proc filesystem" mount -n -t proc /proc /proc
-# Turn off sysrq
-if [ -f /proc/sys/kernel/sysrq -a "$MAGIC_SYSRQ" = "no" ]; then
- echo "0" > /proc/sys/kernel/sysrq
- action "Turning off Magic SysRq key" /bin/true
-fi
-# Turn off Stop-A
-if [ -f /proc/sys/kernel/stop-a -a "$STOP_A" = "no" ]; then
- echo "0" > /proc/sys/kernel/stop-a
- action "Turning off Stop-A/Break-A" /bin/true
-fi
+# Configure kernel parameters
+
+action "Configuring kernel parameters" sysctl -p /etc/sysctl.conf
# Set the system clock.
ARC=0
SRM=0
UTC=0
-
if [ -f /etc/sysconfig/clock ]; then
. /etc/sysconfig/clock
@@ -293,9 +285,10 @@ fi
if [ -f /proc/sys/kernel/modprobe ]; then
if [ -n "$USEMODULES" ]; then
- echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
+ sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
else
- echo "" > /proc/sys/kernel/modprobe
+ # We used to set this to NULL, but that causes 'failed to exec' messages"
+ sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1
fi
fi