home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / serveroncd / Server-on-CD.iso / socd / sbin / rc.d / rc.6 < prev    next >
Encoding:
Text File  |  2003-09-04  |  1.7 KB  |  109 lines

  1. #! /bin/sh
  2.  
  3. PATH=/sbin:/etc:/bin:/usr/bin
  4.  
  5. stty onlcr
  6.  
  7. echo "Running shutdown script $0:"
  8.  
  9. case "$0" in
  10.     *0)
  11.         command="halt"
  12.         ;;
  13.     *6)
  14.         command=reboot
  15.         ;;
  16.     *)
  17.         echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
  18.         exit 1
  19.         ;;
  20. esac
  21.  
  22. if [ ! -e /etc/REBOOT ]
  23.  then
  24.  
  25. killall lpd
  26. umount /mnt/C/socd/spool
  27. losetup -d /dev/loop0
  28.  
  29. mv /etc/mtab /tmp
  30. mv /etc/fstab /tmp
  31.  
  32. echo "Sichere Systemzustand..."
  33. if [ `grep -c "/mnt " /proc/mounts` -ne 0 ]
  34.  then
  35.   if [  `cat "/etc/RUN"`  -eq "1" ]
  36.    then 
  37.     tar czf /mnt/C/linux/etc.tgz /etc
  38.   elif [ ` cat "/etc/RUN" ` -eq "2" ]
  39.    then 
  40.     tar czf /mnt/C/linux/etc.tgz.old /etc
  41.      if [ -e /mnt/C/linux/etc.tgz ]
  42.       then
  43.        rm /mnt/C/linux/etc.tgz
  44.      fi
  45.     elif [ ` cat "/etc/RUN" ` -eq "0" ]
  46.    then 
  47.     cp /mnt/C/linux/etc.tgz.old /mnt/C/linux/etc.tgz
  48.     if [ -e /mnt/C/linux/etc.tgz.old ]
  49.      then
  50.       rm /mnt/C/linux/etc.tgz.old
  51.     fi
  52.   fi
  53. fi
  54.  
  55. mv /tmp/mtab /etc
  56. mv /tmp/fstab /etc
  57.  
  58. fi
  59.  
  60. umount -a
  61.  
  62. if [ "$1" != "fast" ]; then
  63.   killall5 -15 
  64.   sleep 5
  65.   killall5 -9
  66. fi
  67.  
  68. $command -w
  69.  
  70. sync
  71. sleep 1
  72. wait
  73.  
  74. if [ "$command" = "reboot" ]; then
  75.   echo "Rebooting."
  76.   reboot
  77. else
  78.   echo " "
  79.   echo " "
  80.   echo " "
  81.   echo " "
  82.   echo " "
  83.   echo " "
  84.   echo " "
  85.   echo " "
  86.   echo " "
  87.   echo " "
  88.   echo " "
  89.   echo " "
  90.   echo " "
  91.   echo " "
  92.   echo " "
  93.   echo " "
  94.   echo " "
  95.   echo " "
  96.   echo " "
  97.   echo " "
  98.   echo " "
  99.   echo " "
  100.   echo "                    *********************************************"
  101.   echo "                    *                                           *"
  102.   echo "                    *      You can switch off the PC now.       *"
  103.   echo "                    *                                           *"
  104.   echo "                    *********************************************"
  105.   echo " "
  106.   echo " "
  107.   poweroff
  108. fi
  109.