#! /bin/csh
#syslog -p -i DAILY -INFO "dailyerrs: started"
# $Header: dailyerrs,v 4.300 91/06/09 00:59:25 root Rel41 $
#	Copyright 1990 Sony Corp.
#	Copyright 1990 Performance Systems International Inc.
#       copyright 1988 NYSERNet, Inc.
#	All Rights Reserved.
#
#
source ../../config/report-env
if (-e $ROOT/config/daily-env) then
  source $ROOT/config/daily-env
else
  echo "$0 : daily-env missing. Can't continue. Exit."
  exit(1)
endif

if ($#argv >= 1) then
	set ext=$argv[1]
else
	echo "Usage: $0 mmddyy"
	exit(1)
endif
#
if (! $?DAILYREPORTS) then
  set file = $ROOT/daily/report/$ext/Errs
else
  set   file=$DAILYREPORTS/$ext/Errs
endif

if (! -e $file:h) then
  mkdir $file:h
endif

if (-e $file) then
  /bin/rm $file
endif 

$BIN/dailydelta $ext > $file
#cp $file ~ftp/stats
if ($?OPERATER) then
  if ($?DAILYREPORTDIR) then
    set where=$DAILYREPORTDIR
  else
    set where=$file:h
  endif
  echo "daily errors are in $where on $HOST" | /usr/ucb/mail -s "large_daily_errors" $OPERATER
endif
