home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 4.ddi / etc / cron.d / logchecker < prev    next >
Encoding:
Text File  |  1990-12-08  |  1019 b   |  47 lines

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