home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20120305.etc.tar.gz / bradford.20120305.etc.tar / etc / init.d / halt < prev    next >
Text File  |  2006-03-17  |  4KB  |  158 lines

  1. #! /bin/sh
  2. # Copyright (c) 1996-2002 SuSE Linux AG, Nuernberg, Germany.
  3. # All rights reserved.
  4. #
  5. # Author: Florian La Roche, 1996
  6. #      Werner Fink <werner@suse.de>, 1996-2001
  7. #
  8. # Please send feedback to http://www.suse.de/feedback
  9. #
  10. # /etc/init.d/halt (and symlinked to reboot)
  11. #
  12.  
  13. . /etc/rc.status
  14. . /etc/sysconfig/clock
  15. . /etc/sysconfig/shutdown
  16.  
  17. #
  18. # Avoid being interrupted by child or keyboard
  19. #
  20. trap "echo" SIGINT SIGSEGV SIGQUIT SIGTERM
  21. set +e
  22.  
  23. case "$0" in
  24.     *halt)
  25.         message="The system will be halted immediately."
  26.         case `/bin/uname -m` in
  27.                     i?86)
  28.                         command="halt"
  29.                         if test -e /proc/apm -o -e /proc/acpi -o -e /proc/sys/acpi ; then
  30.                             command="halt -p"
  31.                         else
  32.                             read cmdline < /proc/cmdline
  33.                             case "$cmdline" in
  34.                                 *apm=smp-power-off*|*apm=power-off*)  command="halt -p" ;;
  35.                             esac
  36.                         fi
  37.                         ;;
  38.                     *)
  39.                         command="halt -p"
  40.                         ;;
  41.                 esac
  42.         ;;
  43.     *reboot)
  44.         message="Please stand by while rebooting the system..."
  45.         command="reboot"
  46.         ;;
  47.     *)
  48.         echo "$0: call me as \"halt\" or \"reboot\" please!"
  49.         exit 1
  50.         ;;
  51. esac
  52.  
  53. #
  54. # first do local stuff
  55. #
  56. rc_reset
  57. test -e /etc/init.d/halt.local && {
  58.     echo Running /etc/init.d/halt.local
  59.     /bin/sh /etc/init.d/halt.local
  60.     rc_status -v1 -r
  61. }
  62.  
  63. # Write to wtmp file before unmounting /var
  64. $command -w 
  65.  
  66. # Set a flag that we had success upto this point
  67. > /success
  68.  
  69. # Stop blogd before umounting /var
  70. test -x /sbin/blogd && killproc -QUIT /sbin/blogd
  71.  
  72. echo "Sending all processes the TERM signal..."
  73. killall5 -15
  74. echo -e "$rc_done_up"
  75.  
  76. sleep 1
  77. test "$1" = "fast" -o -e /fastboot || sleep 4
  78.  
  79. echo "Sending all processes the KILL signal..."
  80. killall5 -9
  81. echo -e "$rc_done_up"
  82.  
  83. # Redirect our mesages to default console
  84. test -n "$REDIRECT" && exec 0<> $REDIRECT 1>&0 2>&0
  85.  
  86. #
  87. # call modules in boot.d via K* symlinks
  88. # (reverse sequence)
  89. #
  90.  
  91. if test -d /etc/init.d/boot.d/ ; then
  92.     for i in /etc/init.d/boot.d/K*; do
  93.         test -f $i || continue
  94.         if test -x "$i" ; then
  95.             # Active boot scripts, should have their own messages
  96.             $i stop
  97.         else
  98.             # Old boot scripts, may not have any message
  99.             echo Skipping $i, not executable
  100.         fi
  101.     done
  102. fi
  103.  
  104. # kill splash animation
  105. test "$SPLASH" = yes && /sbin/splash -q
  106.  
  107. umount -anvt proc
  108.  
  109. # on umsdos fs this would lead to an error message, so direct errors to
  110. # /dev/null
  111. mount -no remount,ro / 2> /dev/null
  112. sync
  113.  
  114. # show "the system is down" message
  115. if test "$SPLASH" = yes ; then
  116.     mount -nt proc proc /proc
  117.     /sbin/splash -q -p 65535 -t "isdown"
  118.     umount -n /proc
  119. fi
  120.  
  121. # Make reboot noise and wait a few seconds to give harddisks the chance
  122. # to really flush their buffers before power goes down.
  123. if test -n "$REDIRECT" ; then
  124.     sleep 1
  125.     case "$HALT_SOUND" in
  126.     "yes"|"quint")
  127.     echo -en "\033[10;393]\a\033[10;262]"
  128.     sleep 1
  129.     ;;
  130.     "octave")
  131.     for tone in 524 491 440 393 349 328 295 ; do
  132.         echo -en "\033[10;${tone}]\a"
  133.         usleep 125000
  134.     done
  135.     echo -en "\033[10;262]"
  136.     ;;
  137.     "no")
  138.     ;;
  139.     *)
  140.         echo -en "\033[10;440]\a"
  141.     usleep 250000
  142.     ;;
  143.     esac
  144. else
  145.     test "$HALT_SOUND" = "no" || echo -en "\a"
  146.     sleep 2
  147. fi
  148. echo $message
  149. test "$HALT_SOUND" = "no" || echo -en "\a"
  150.  
  151. test -n "$HALT_POWERDOWN_INSERT" && $HALT_POWERDOWN_INSERT
  152.  
  153. # Set system console back to intial value
  154. test -n "$REDIRECT" -a -n "$CONSOLE" && setconsole $REDIRECT < $CONSOLE
  155.  
  156. # Now talk to kernel
  157. exec $command -d -f
  158.