#!/bin/sh
# this is a simple script for generating statistics on the log

# the argument to this script is the name of the server log file.

if (test $# -eq 0)
then
	echo "usage: $0 <server-log-file>"
	echo "  Generates statistics on the use of the Server"
	exit 1
fi

my_dir=`dirname $0`
my_name=`basename $0`

if (test $my_dir -eq ""); then
  for dir in $PATH; do
    if [ -f $dir/$my_name ]; then
      my_dir=$dir
    fi
  done
fi

cat $* | $my_dir/trunc 80 | awk -f $my_dir/stats.awk

echo -n "Errors: "
egrep -i '(error|: -1:)' $* | wc -l | awk '{ print $1 }'
