home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / UNIX3862.ZIP / U386-06.ZIP / U386-6.TD0 / usr / lib / cron / logchecker < prev    next >
Encoding:
Text File  |  1988-06-26  |  888 b   |  42 lines

  1. :
  2. #    Copyright (c) 1984, 1986, 1987, 1988 AT&T
  3. #      All Rights Reserved
  4.  
  5. #    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
  6. #    The copyright notice above does not evidence any
  7. #    actual or intended publication of such source code.
  8.  
  9. #ident    "@(#)cron:logchecker.sh    1.3"
  10.  
  11. # this command is used to determine if the cron log file is approaching the ulimit
  12. # of the system.  If it is, then the log file will be moved to olog
  13. # this command is executed by the crontab entry 'root'
  14.  
  15. #set umask
  16. umask 022
  17.  
  18. # log files
  19. LOG=/usr/lib/cron/log
  20. OLOG=/usr/lib/cron/olog
  21.  
  22. # set the high-water mark of the file
  23. MARKER=4
  24. LIMIT=`ulimit`
  25. LIMIT=`expr $LIMIT - $MARKER`
  26.  
  27. # find the size of the log file (in blocks)
  28. if [ -f $LOG ]
  29. then
  30.     FILESIZE=`du -a $LOG | cut -f1`
  31. else
  32.     exit
  33. fi
  34.  
  35. # move log file to olog file if the file is too big
  36. if [ $FILESIZE -ge $LIMIT ]
  37. then
  38.     cp $LOG $OLOG
  39.     >$LOG
  40.     chgrp bin $OLOG
  41. fi
  42.