diff options
author | Bill Nottingham <notting@redhat.com> | 1999-02-03 19:34:29 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 1999-02-03 19:34:29 +0000 |
commit | 78f1af4fcbcc1193db5e9db036359e14cc98afd9 (patch) | |
tree | d4e80f4f61ef4d6f7d436b49ac7f113182a82ca9 | |
parent | d503a6fe70268f6b451a80b3fc89641f33491e9e (diff) | |
download | initscripts-78f1af4fcbcc1193db5e9db036359e14cc98afd9.tar initscripts-78f1af4fcbcc1193db5e9db036359e14cc98afd9.tar.gz initscripts-78f1af4fcbcc1193db5e9db036359e14cc98afd9.tar.bz2 initscripts-78f1af4fcbcc1193db5e9db036359e14cc98afd9.tar.xz initscripts-78f1af4fcbcc1193db5e9db036359e14cc98afd9.zip |
more initlog changes; wait a little longer for kill -TERM
-rwxr-xr-x | rc.d/init.d/functions | 22 | ||||
-rwxr-xr-x | rc.d/init.d/halt | 23 | ||||
-rwxr-xr-x | rc.d/init.d/network | 26 | ||||
-rwxr-xr-x | rc.d/init.d/nfsfs | 6 | ||||
-rwxr-xr-x | rc.d/init.d/random | 9 | ||||
-rwxr-xr-x | rc.d/init.d/single | 6 | ||||
-rwxr-xr-x | rc.d/rc | 12 |
7 files changed, 57 insertions, 47 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index e69f27f4..525ecc6d 100755 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -44,10 +44,8 @@ daemon() { # problems with the daemon, it also closes some security problems ulimit -c 0 - # - if [ $BOOTUP != "color" ]; then - echo -n $base - fi + # Echo daemon + [ $BOOTUP != "color" ] && echo -n $base # And start it up. nice -n $nicelevel initlog -q -c "$*" && success -n "$base startup" || failure -n "$base startup" @@ -78,19 +76,24 @@ killproc() { # Kill it. if [ "$pid" != "" ] ; then - echo -n "$base " + [ $BOOTUP != "color" ] && echo -n $base if [ "$notset" = 1 ] ; then # TERM first, then KILL if not dead kill -TERM $pid usleep 100000 if ps h $pid >/dev/null 2>&1 ; then - sleep 3 - kill -KILL $pid + sleep 1 + if ps h $pid >/dev/null 2>&1 + sleep 3 + kill -KILL $pid && success "$base shutdown" || failure "$base shutdown" + fi fi # use specified level only else - kill $killlevel $pid + kill $killlevel $pid && success "$base shutdown" || failure "$base shutdown" fi + else + failure -n "$base shutdown" fi # Remove pid file if any. @@ -173,6 +176,7 @@ echo_failure() { return 0 } +# Log that something succeeded success() { if [ "$1" = "-n" ]; then ECHOARGS="-n" @@ -189,6 +193,7 @@ success() { return 0 } +# Log that something failed failure() { if [ "$1" = "-n" ]; then ECHOARGS="-n" @@ -205,6 +210,7 @@ failure() { return 0 } +# Run some action. Log its output. action() { if [ "$1" = "-n" ]; then ECHOARGS="-n" diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt index 552f8f16..d902d105 100755 --- a/rc.d/init.d/halt +++ b/rc.d/init.d/halt @@ -30,36 +30,37 @@ esac # Kill all processes. [ "${BASH+bash}" = bash ] && enable kill -echo "Sending all processes the TERM signal..." -kill -15 -1 +action "Sending all processes the TERM signal..." kill -15 -1 sleep 5 -echo "Sending all processes the KILL signal.." -kill -9 -1 +action "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. -echo "Turning off swap and accounting" -swapoff -a +action "Turning off swap and accounting" swapoff -a [ -x /sbin/accton ] && /sbin/accton -echo "Unmounting file systems" -umount -a -f +action "Unmounting file systems" umount -a -f mount -n -o remount,ro / # turn off raid if [ -x /sbin/raidstop -a -f /etc/raidtab ]; then - /sbin/raidstop -a + action "Turning off RAID" /sbin/raidstop -a fi -echo "Remounting remaining filesystems (if any) readonly" +# Remount read only anything that's left mounted. +#echo "Remounting remaining filesystems (if any) readonly" mount | awk '/ext2/ { print $3 }' | while read line; do mount -n -o ro,remount $line done # Now halt or reboot. echo "$message" -[ -f /fastboot ] && echo "On the next boot fsck will be skipped." +if [ -f /fastboot ]; then + echo "On the next boot fsck will be skipped." +elif [ -f /forcefsck ]; + echo "On the next boot fsck will be forced." +fi eval $command -i -d diff --git a/rc.d/init.d/network b/rc.d/init.d/network index f21de187..9b01c324 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -50,10 +50,10 @@ ipv4_forward_set () else if [ "$FORWARD_IPV4" = "no" -o "$FORWARD_IPV4" = "false" ]; then value=0 - message="Disabling IPv4 packet forwarding." + message="Disabling IPv4 packet forwarding" else value=1 - message="Enabling IPv4 packet forwarding." + message="Enabling IPv4 packet forwarding" fi if [ $value != `cat /proc/sys/net/ipv4/ip_forward` ]; then @@ -95,7 +95,7 @@ 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" echo 0 > /proc/sys/net/ipv4/ip_forward rm -f /var/lock/subsys/network ;; status) @@ -124,34 +124,34 @@ case "$1" in ipv4_forward_set fi for device in $DEV_UP ; do - ./ifup $device + action "Bringing up device $device" ./ifup $device done for device in $DEV_DOWN ; do - ./ifdown $device + action "Shutting down device $device" ./ifdown $device done for device in $DEV_RECONF ; do - ./ifdown $device - ./ifup $device + action "Shutting down device $device" ./ifdown $device + action "Bringing up device $device" ./ifup $device done for device in $DEV_RECONF_ALIASES ; do - /etc/sysconfig/network-scripts/ifup-aliases $device + action "Briging up alias $device" /etc/sysconfig/network-scripts/ifup-aliases $device done for device in $DEV_RECONF_ROUTES ; do - /etc/sysconfig/network-scripts/ifup-routes $device + action "Bringing up route $device" /etc/sysconfig/network-scripts/ifup-routes $device done case $IPX in yes|true) case $IPXINTERNALNET in reconf) - /sbin/ipx_internal_net del - /sbin/ipx_internal_net add $IPXINTERNALNETNUM \ + action "Deleting internal IPX network" /sbin/ipx_internal_net del + action "Adding internal IPX network $IPXINTERNALNETNUM $IPXINTERNALNODENUM" /sbin/ipx_internal_net add $IPXINTERNALNETNUM \ $IPXINTERNALNODENUM ;; add) - /sbin/ipx_internal_net add $IPXINTERNALNETNUM \ + action "Adding internal IPX network $IPXINTERNALNETNUM $IPXINTERNALNODENUM"/sbin/ipx_internal_net add $IPXINTERNALNETNUM \ $IPXINTERNALNODENUM ;; del) - /sbin/ipx_internal_net del + action "Deleting internal IPX network" /sbin/ipx_internal_net del ;; esac ;; diff --git a/rc.d/init.d/nfsfs b/rc.d/init.d/nfsfs index 108b8036..f4789781 100755 --- a/rc.d/init.d/nfsfs +++ b/rc.d/init.d/nfsfs @@ -26,14 +26,12 @@ fi # See how we were called. case "$1" in start) - echo -n "Mounting remote filesystems." - mount -a -t nfs + action -n "Mounting remote filesystems" mount -a -t nfs touch /var/lock/subsys/nfsfs echo ;; stop) - echo -n "Unmounting remote filesystems." - umount -a -t nfs + action -n "Unmounting remote filesystems" umount -a -t nfs rm -f /var/lock/subsys/nfsfs echo ;; diff --git a/rc.d/init.d/random b/rc.d/init.d/random index 55775f1a..3375141b 100755 --- a/rc.d/init.d/random +++ b/rc.d/init.d/random @@ -16,14 +16,14 @@ random_seed=/var/run/random-seed # See how we were called. case "$1" in start) - echo "Initializing random number generator..." # 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 - cat $random_seed >/dev/urandom + cmd="cat $random_seed >/dev/urandom" else - touch $random_seed + cmd="touch $random_seed" fi + action "Initializing random number generator" $cmd chmod 600 $random_seed dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null touch /var/lock/subsys/random @@ -32,10 +32,9 @@ case "$1" in stop) # Carry a random seed from shut-down to start-up # Save 512 bytes, which is the size of the entropy pool - echo "Saving random seed..." touch $random_seed chmod 600 $random_seed - dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null + action "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/init.d/single b/rc.d/init.d/single index 20e50b10..a2d4291e 100755 --- a/rc.d/init.d/single +++ b/rc.d/init.d/single @@ -16,11 +16,9 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin # Kill all processes. [ "${BASH+bash}" = bash ] && enable kill -echo "Sending all processes the TERM signal..." -kill -15 -1 +action "Sending all processes the TERM signal..." kill -15 -1 sleep 5 -echo "Sending all processes the KILL signal.." -kill -9 -1 +action "Sending all processes the KILL signal.." kill -9 -1 rm -f /var/lock/subsys/* @@ -51,7 +51,11 @@ if [ -d /etc/rc.d/rc$runlevel.d ]; then [ ! -f /var/lock/subsys/${subsys}.init ] && continue # Bring the subsystem down. - $i stop + if [ egrep -q "(killproc|action)" $i ]; then + $i stop + else + action "Stopping $subsys" $i stop + fi done # Now run the START scripts. @@ -86,6 +90,10 @@ if [ -d /etc/rc.d/rc$runlevel.d ]; then } # Bring the subsystem up. - $i start + if [ egrep -q "(daemon|action)" $i ]; then + $i start + else + action "Starting $subsys" $i start + fi done fi |