home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- #
- # rc.6 This file is executed by init when it goes into runlevel
- # 0 (halt) or runlevel 6 (reboot). It kills all processes,
- # unmounts file systems and then either halts or reboots.
- #
- # Version: @(#)/etc/rc.d/rc.6 2.47 Sat Jan 13 13:37:26 PST 2001
- #
- # Author: Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
- # Modified by: Patrick J. Volkerding, <volkerdi@slackware.com>
- #
-
- # Set the path.
- PATH=/sbin:/etc:/bin:/usr/bin
-
- # Set linefeed mode to avoid staircase effect.
- stty onlcr
-
- # Find out how we were called.
- case "$0" in
- *0)
- command="halt"
- ;;
- *6)
- command=reboot
- ;;
- *)
- echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
- exit 1
- ;;
- esac
-
- killall5 -15
- sleep 5
- killall5 -9
-
- # Before unmounting file systems write a reboot or halt record to wtmp.
- $command -w
-
- # Carry a random seed between reboots.
- # Save 512 bytes, which is the size of the entropy pool.
- dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
-
- # Turn off swap, then unmount local file systems.
- echo "Turning off swap."
- swapoff -a
- echo "Unmounting local file systems."
- umount -a -r
-
- # This never hurts:
- sync
-