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.0 next >
Encoding:
Text File  |  2004-07-02  |  2.0 KB  |  128 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. /bin/rm /etc/liz
  23.  
  24. if [ ! -e /etc/REBOOT ]
  25. then
  26. mv /etc/mtab /tmp
  27. mv /etc/fstab /tmp
  28.  
  29. if [ ! -d /mnt/C/socd ]
  30.  then
  31.   mkdir /mnt/C/socd
  32. fi
  33.  
  34. if [ -e /etc/IPNR ]
  35.  then
  36.  echo "Sichere Systemzustand..."
  37.  if [ `grep -c "/tmp/" /proc/mounts` -ne 0 ]
  38.  then
  39.   if [  `cat "/etc/RUN"`  -eq "0" ]
  40.    then
  41.     tar czf /mnt/C/socd/etc.tgz /etc
  42.   elif [  `cat "/etc/RUN"`  -eq "1" ]
  43.    then 
  44.     tar czf /mnt/C/socd/etc.tgz /etc
  45.     cp /mnt/C/socd/etc.tgz /mnt/C/socd/etc.tgz.old
  46.   elif [ ` cat "/etc/RUN" ` -eq "2" ]
  47.    then 
  48.     tar czf /mnt/C/socd/etc.tgz.old /etc
  49.      if [ -e /mnt/C/socd/etc.tgz ]
  50.       then
  51.        rm /mnt/C/socd/etc.tgz
  52.      fi
  53.   elif [ ` cat "/etc/RUN" ` -eq "3" ]
  54.    then
  55.     mv /tmp/C/socd/etc.tgz.old /tmp/C/socd/etc.tgz
  56.   fi
  57.  fi
  58. fi
  59.  
  60. mv /tmp/mtab /etc
  61. mv /tmp/fstab /etc
  62. fi
  63.  
  64. killall5 -15
  65. sleep 5
  66. killall5 -9
  67.  
  68.  
  69. umount -a
  70.  
  71. $command -w
  72.  
  73. sync
  74. sleep 1
  75. wait
  76.  
  77. if [ "$command" = "reboot" ]; then
  78.   echo "Rebooting."
  79.   reboot
  80. else
  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 " "
  103.   echo " "
  104.   echo " "
  105.   echo " "
  106.   echo " "
  107.   echo " "
  108.   echo " "
  109.   echo " "
  110.   echo " "
  111.   echo " "
  112.   echo " "
  113.   echo " "
  114.   echo "                   **********************************************"
  115.   echo "                   *                                            *"
  116.   echo "                   *       Now you can switch off your PC       *"
  117.   echo "                   *       or reboot with CTRL+ALT+DEL          *"
  118.   echo "                   *                                            *"
  119.   echo "                   **********************************************"
  120.   echo " "
  121.   echo " "
  122.   echo " "
  123.   echo " "
  124.   echo " "
  125.   echo " "
  126.   poweroff
  127. fi
  128.