#!/bin/csh -x
#----------------------------------------------------------------------
#
# 	gifin.com
#
#	script to initiate the OPUS sample pipeline:
#	look for *.gif in the gif_data directory
#	if one is found, this command procedure will be
#	invoked.  All it does is create an observation status 
#	file (OSF) so that processing for that observation
#	will proceed.
#--------------------------------------------------------------------
#                          REVISION HISTORY
#--------------------------------------------------------------------
#  MOD             PR
# LEVEL   DATE   NUMBER  User  Description
# ----- -------- ------  ------ -------------------------------------
#  001  06/20/97 34299   Rose   Creation
#       08/08/97 33432   MSwam  add trailer creation and status checking
#  002  08/29/97 35137   Rose   removed .cshrc loggin
#  003  01/13/98 34499.3 MSwam  use lowercase BB for UNIX
#  004  02/20/98 35847   WMiller Set redirections for noclobber
#  005  08/10/05 53803   MSwam  Change PATH_FILE_NAME to PATH_BASENAME
#----------------------------------------------------------------------
#
set obname = `basename $EVENT_NAME`

# create and begin filling the observation trailer file
echo " "
echo "`date`"
echo "---------------- Starting GIFIN ----------------------------" >! $OUTPATH/$obname:r.trx
echo "`date`" >>! $OUTPATH/$obname:r.trx

# create the observation status file for this observation
echo "running osf_create..."
osf_create -p $PATH_BASENAME -f $obname:r -t gif -s cww >>&! $OUTPATH/$obname:r.trx
set savestat = $status
if ( $savestat == 1 ) then
    echo "ERROR: unable to create OSF for $obname:r" >>! $OUTPATH/$obname:r.trx
    echo "ERROR creating OSF"
endif
echo "---------------- Ending GIFIN ------------------------------" >>! $OUTPATH/$obname:r.trx
echo " "
exit $savestat
