From e8d2f95c03d1df94ca6ab9bab11f0f1d8e8c5893 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 4 Feb 1999 01:03:34 +0000 Subject: bugfixes... --- rc.d/init.d/functions | 11 ++++------- rc.d/init.d/halt | 22 ++++++++++++++-------- rc.d/init.d/network | 6 ++++-- rc.d/init.d/nfsfs | 2 -- rc.d/init.d/random | 9 ++++----- rc.d/rc | 12 ++++++++---- rc.d/rc.sysinit | 2 -- 7 files changed, 34 insertions(+), 30 deletions(-) (limited to 'rc.d') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 525ecc6d..c3b42a65 100755 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -79,18 +79,18 @@ killproc() { [ $BOOTUP != "color" ] && echo -n $base if [ "$notset" = 1 ] ; then # TERM first, then KILL if not dead - kill -TERM $pid + kill -TERM $pid && success -n "$base shutdown" || failure -n "$base shutdown" usleep 100000 if ps h $pid >/dev/null 2>&1 ; then sleep 1 - if ps h $pid >/dev/null 2>&1 + if ps h $pid >/dev/null 2>&1 ; then sleep 3 - kill -KILL $pid && success "$base shutdown" || failure "$base shutdown" + kill -KILL $pid && success -n "$base shutdown" || failure -n "$base shutdown" fi fi # use specified level only else - kill $killlevel $pid && success "$base shutdown" || failure "$base shutdown" + kill $killlevel $pid && success -n "$base shutdown" || failure -n "$base shutdown" fi else failure -n "$base shutdown" @@ -263,6 +263,3 @@ confirm() { ;; esac } - - - diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt index 3d6df5cc..61eab7b3 100755 --- a/rc.d/init.d/halt +++ b/rc.d/init.d/halt @@ -11,6 +11,14 @@ # Set the path. PATH=/sbin:/bin:/usr/bin:/usr/sbin +. /etc/rc.d/init.d/functions + +runcmd() { + echo -n $1 + shift + $* && echo_success -n || echo_failure -n +} + # See how we were called. case "$0" in *halt) @@ -30,22 +38,22 @@ esac # Kill all processes. [ "${BASH+bash}" = bash ] && enable kill -action "Sending all processes the TERM signal..." kill -15 -1 +runcmd "Sending all processes the TERM signal..." kill -15 -1 sleep 5 -action "Sending all processes the KILL signal.." kill -9 -1 +runcmd "Sending all processes the KILL signal.." kill -9 -1 # Write to wtmp file before unmounting /var halt -w # Turn off swap, then unmount file systems. -action "Turning off swap and accounting" swapoff -a +runcmd "Turning off swap and accounting" swapoff -a [ -x /sbin/accton ] && /sbin/accton -action "Unmounting file systems" umount -a -f +runcmd "Unmounting file systems" umount -a -f mount -n -o remount,ro / # turn off raid if [ -x /sbin/raidstop -a -f /etc/raidtab ]; then - action "Turning off RAID" /sbin/raidstop -a + runcmd "Turning off RAID" /sbin/raidstop -a fi # Remount read only anything that's left mounted. @@ -58,9 +66,7 @@ done echo "$message" if [ -f /fastboot ]; then echo "On the next boot fsck will be skipped." -elif [ -f /forcefsck ]; +elif [ -f /forcefsck ]; then echo "On the next boot fsck will be forced." fi eval $command -i -d -p - - diff --git a/rc.d/init.d/network b/rc.d/init.d/network index 9b01c324..93f86480 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -57,7 +57,8 @@ ipv4_forward_set () fi if [ $value != `cat /proc/sys/net/ipv4/ip_forward` ]; then - action -n "$message" echo "$value" > /proc/sys/net/ipv4/ip_forward + action -n "$message" /bin/true + echo "$value" > /proc/sys/net/ipv4/ip_forward fi fi fi @@ -95,7 +96,8 @@ case "$1" in ;; esac ./ifdown ifcfg-lo - action -n "Disabling IPv4 packet forwarding" echo 0 > /proc/sys/net/ipv4/ip_forward + action -n "Disabling IPv4 packet forwarding" /bin/true + echo 0 > /proc/sys/net/ipv4/ip_forward rm -f /var/lock/subsys/network ;; status) diff --git a/rc.d/init.d/nfsfs b/rc.d/init.d/nfsfs index f4789781..9b828248 100755 --- a/rc.d/init.d/nfsfs +++ b/rc.d/init.d/nfsfs @@ -28,12 +28,10 @@ case "$1" in start) action -n "Mounting remote filesystems" mount -a -t nfs touch /var/lock/subsys/nfsfs - echo ;; stop) action -n "Unmounting remote filesystems" umount -a -t nfs rm -f /var/lock/subsys/nfsfs - echo ;; status) if [ -f /proc/mounts ] ; then diff --git a/rc.d/init.d/random b/rc.d/init.d/random index 3375141b..27f2abd4 100755 --- a/rc.d/init.d/random +++ b/rc.d/init.d/random @@ -1,4 +1,3 @@ -#!/bin/sh # # random Script to snapshot random state and reload it at boot time. # @@ -19,11 +18,11 @@ case "$1" in # Carry a random seed from start-up to start-up # Load and then save 512 bytes, which is the size of the entropy pool if [ -f $random_seed ]; then - cmd="cat $random_seed >/dev/urandom" + cat $random_seed >/dev/urandom else - cmd="touch $random_seed" + touch $random_seed fi - action "Initializing random number generator" $cmd + action -n "Initializing random number generator" /bin/true chmod 600 $random_seed dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null touch /var/lock/subsys/random @@ -34,7 +33,7 @@ case "$1" in # Save 512 bytes, which is the size of the entropy pool touch $random_seed chmod 600 $random_seed - action "Saving random seed" dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null + action -n "Saving random seed" dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null rm -f /var/lock/subsys/random ;; diff --git a/rc.d/rc b/rc.d/rc index d84b219e..449df6cb 100755 --- a/rc.d/rc +++ b/rc.d/rc @@ -51,10 +51,10 @@ if [ -d /etc/rc.d/rc$runlevel.d ]; then [ ! -f /var/lock/subsys/${subsys}.init ] && continue # Bring the subsystem down. - if [ egrep -q "(killproc|action)" $i ]; then + if egrep -q "(killproc |action )" $i ; then $i stop else - action "Stopping $subsys" $i stop + action -n "Stopping $subsys" $i stop fi done @@ -90,10 +90,14 @@ if [ -d /etc/rc.d/rc$runlevel.d ]; then } # Bring the subsystem up. - if [ egrep -q "(daemon|action)" $i ]; then + if egrep -q "(daemon |action )" $i ; then $i start else - action "Starting $subsys" $i start + if [ "$subsys" = "halt" ] || [ "$subsys" = "reboot" ]; then + $i start + else + action -n "Starting $subsys" $i start + fi fi done fi diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index af93e42b..ab962b70 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -331,5 +331,3 @@ dmesg > /var/log/dmesg # Feed entropy into the entropy pool /etc/rc.d/init.d/random start - -sleep 10 -- cgit v1.2.1