#!/bin/csh
#----------------------------------------------------------------------
#
#       pipect.com
#
#       A script to count the observations at various stages of
#	pipeline processing and log the results.
#
#--------------------------------------------------------------------
#                          REVISION HISTORY
#--------------------------------------------------------------------
#  MOD             PR
# LEVEL   DATE   NUMBER  User  Description
# ----- -------- ------  ------ -------------------------------------
#  001  08/12/97 33432   MSwam  Creation
#  002  02/20/98 35947   WMiller Set redirections for noclobber
#
#----------------------------------------------------------------------
#
# count the number of each pipeline product and write the count to a log
#
echo "`date`"
set initcount = `ls -1 $INPATH/$INIT_STATE | wc -l`
set gifincount = `ls -1 $INPATH/$GIFIN_STATE | wc -l`
set getkwcount = `ls -1 $INPATH/$GETKW_STATE | wc -l`
set g2fcount = `ls -1 $OUTPATH/$G2F_STATE | wc -l`
set listhdcount = `ls -1 $OUTPATH/$LISTHD_STATE | wc -l`
set comprscount = `ls -1 $OUTPATH/$COMPRS_STATE | wc -l`
#
echo "`date '+%Y%m%d%H%M%S'` $initcount $gifincount $getkwcount $g2fcount $listhdcount $comprscount" >>! $OUTPATH/pipect.log
set savestat = $status
if ( $savestat == 1 ) then
    echo "ERROR: pipect failed."
endif
exit $savestat
