home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / server / Server-on-CD.iso / socd / boot / template / hd / rc.6 < prev   
Encoding:
Text File  |  2003-09-04  |  1.1 KB  |  52 lines

  1. #! /bin/sh
  2. #
  3. # rc.6        This file is executed by init when it goes into runlevel
  4. #        0 (halt) or runlevel 6 (reboot). It kills all processes,
  5. #        unmounts file systems and then either halts or reboots.
  6. #
  7. # Version:    @(#)/etc/rc.d/rc.6    2.47 Sat Jan 13 13:37:26 PST 2001
  8. #
  9. # Author:    Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
  10. # Modified by:  Patrick J. Volkerding, <volkerdi@slackware.com>
  11. #
  12.  
  13. # Set the path.
  14. PATH=/sbin:/etc:/bin:/usr/bin
  15.  
  16. # Set linefeed mode to avoid staircase effect.
  17. stty onlcr
  18.  
  19. # Find out how we were called.
  20. case "$0" in
  21.     *0)
  22.         command="halt"
  23.         ;;
  24.     *6)
  25.         command=reboot
  26.         ;;
  27.     *)
  28.         echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
  29.         exit 1
  30.         ;;
  31. esac
  32.  
  33. killall5 -15 
  34. sleep 5
  35. killall5 -9
  36.  
  37. # Before unmounting file systems write a reboot or halt record to wtmp.
  38. $command -w
  39.  
  40. # Carry a random seed between reboots.
  41. # Save 512 bytes, which is the size of the entropy pool.
  42. dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
  43.  
  44. # Turn off swap, then unmount local file systems.
  45. echo "Turning off swap."
  46. swapoff -a
  47. echo "Unmounting local file systems."
  48. umount -a -r
  49.  
  50. # This never hurts:
  51. sync
  52.