home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 4.ddi / sbin / fsanck < prev   
Encoding:
Text File  |  1990-12-08  |  797 b   |  28 lines

  1. #!/sbin/sh
  2.  
  3.  
  4. #ident    "@(#)/sbin/fsanck.sl 1.1 4.0 12/08/90 51227 AT&T-USL"
  5.  
  6. # Script to check root filesystem, periodically, at shutdown
  7. # to catch any possible filesystem corruption early and correct.
  8. #
  9. PATH=/bin:/usr/bin:/etc        # make absolutely sure of PATH
  10. LAST=/etc/.lastfsck
  11.  
  12. # see how long its been since the last fsck at shutdown.
  13.     if [ ! -f $LAST ] ; then
  14.         touch 0101000071 $LAST
  15.     fi
  16.     its_time=`find $LAST -mtime +0 -print`
  17.     if [ -z "$its_time" ] ; then exit 0; fi
  18.  
  19. # get name of root filesystem
  20.     rfs=`/etc/devnm / | tr -s "\040\011" "\011*" | cut -f1 | \
  21.             sed -e "/swap/d" -e "s!^!/dev/!"`
  22.  
  23. # call fsck and update .lastfsck
  24.     # echo "Checking root filesystem ($rfs)."
  25.     touch $LAST; sync; sleep 7
  26.     /etc/fsck -y -s -b $rfs > /dev/null 2>&1
  27. # Using the -b option will force user to reboot.
  28.