home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / Programming / Source / WAIS / bin / server_stats < prev    next >
Encoding:
Text File  |  1992-02-02  |  566 b   |  28 lines

  1. #!/bin/sh
  2. # this is a simple script for generating statistics on the log
  3.  
  4. # the argument to this script is the name of the server log file.
  5.  
  6. if (test $# -eq 0)
  7. then
  8.     echo "usage: $0 <server-log-file>"
  9.     echo "  Generates statistics on the use of the Server"
  10.     exit 1
  11. fi
  12.  
  13. my_dir=`dirname $0`
  14. my_name=`basename $0`
  15.  
  16. if (test $my_dir -eq ""); then
  17.   for dir in $PATH; do
  18.     if [ -f $dir/$my_name ]; then
  19.       my_dir=$dir
  20.     fi
  21.   done
  22. fi
  23.  
  24. cat $* | $my_dir/trunc 80 | awk -f $my_dir/stats.awk
  25.  
  26. echo -n "Errors: "
  27. egrep -i '(error|: -1:)' $* | wc -l | awk '{ print $1 }'
  28.