home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 5.ddi / sbin / rc6 < prev    next >
Encoding:
Text File  |  1990-12-08  |  2.2 KB  |  118 lines

  1.  
  2.  
  3. #    Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
  4. #      All Rights Reserved
  5.  
  6. #    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
  7. #    The copyright notice above does not evidence any
  8. #    actual or intended publication of such source code.
  9.  
  10. #    "Run Commands" for init state 6
  11. #    Leaves the system in a state where it is safe to turn off the power 
  12. #    or reboot.
  13. #
  14.  
  15. umask 022
  16. echo 'The system is coming down.  Please wait.'
  17.  
  18. # make sure /usr is mounted before proceeding since init scripts
  19. # and this shell depend on things on /usr file system
  20. /sbin/mount /usr > /dev/null 2>&1
  21.  
  22. #    The following segment is for historical purposes.
  23. #    There should be nothing in /etc/shutdown.d.
  24. if [ -d /etc/shutdown.d ]
  25. then
  26.     for f in /etc/shutdown.d/*
  27.     {
  28.         if [ -s $f ]
  29.         then
  30.             /sbin/sh ${f}
  31.         fi
  32.     }
  33. fi
  34. #    End of historical section
  35.  
  36. if [ -d /etc/rc0.d ]
  37. then
  38.     for f in /etc/rc0.d/K*
  39.     {
  40.         if [ -s ${f} ]
  41.         then
  42.             /sbin/sh ${f} stop
  43.         fi
  44.     }
  45.  
  46. #    system cleanup functions ONLY (things that end fast!)    
  47.  
  48.     for f in /etc/rc0.d/S*
  49.     {
  50.         if [ -s ${f} ]
  51.         then
  52.             /sbin/sh ${f} start
  53.         fi
  54.     }
  55. fi
  56.  
  57. trap "" 15
  58. /usr/sbin/killall
  59. /usr/bin/sleep 10
  60. /usr/sbin/killall  9
  61.  
  62. if [ -f /etc/.copy_unix ]
  63. then
  64.     if [ -f /etc/conf/cf.d/unix ]
  65.     then
  66.         mv /stand/unix /stand/unix.old 
  67.         if [ $? -eq 0 ]
  68.         then
  69.             echo Saved the old unix kernel
  70.             rm -f /etc/.copy_unix
  71.         else
  72.             echo Can not save the old unix kernel.  Not enough space in /stand
  73.         fi
  74.  
  75.         ok=0
  76.         cp /etc/conf/cf.d/unix /stand/unix 
  77.         if [ ! $? -eq 0 ]
  78.         then
  79.             echo Failed to install the new unix kernel in /stand
  80.             echo Retrying after removing the old unix kernel
  81.             rm -f /stand/unix.old
  82.             cp /etc/conf/cf.d/unix /stand/unix 
  83.             if [ ! $? -eq 0 ]
  84.             then
  85.                 ok=1
  86.                 echo Failed to install the new unix kernel in /stand
  87.                 echo Linking /etc/conf/cf.d/unix to /unix instead
  88.                 rm -f /unix
  89.                 ln /etc/conf/cf.d/unix /unix
  90.             fi
  91.         fi
  92.         
  93.         if [ $ok -eq 0 ]
  94.         then        
  95.             rm -f /unix
  96.             ln -s /stand/unix /unix
  97.             echo Installed new unix kernel 
  98.         fi
  99.     fi
  100. fi
  101.  
  102. /sbin/sync;/sbin/sync;/sbin/sync
  103. /sbin/umountall
  104. rm -rf /tmp/*
  105. /sbin/sync;/sbin/sync;/sbin/sync
  106. echo '
  107. The system is down.'
  108. /sbin/sync
  109.  
  110. # check if user wants machine rebooted
  111. case "$1" in
  112.         reboot)    echo "
  113. The system is being rebooted."
  114.         /sbin/uadmin 2 1
  115.           ;;
  116. esac
  117.  
  118.