#!/usr/local/bin/bash
##
# WARNING: THIS SCRIPT WAS AUTOMATICALLY GENERATED on Sun Jan  6 20:54:30 CST 2008
#   dp version: v19_100        DP_DIR: /sdss/ups/prd/dp/v19_100/NULL
#   on host     sdssdp41       user: hlin
##
. /fnal/ups/etc/setups.sh
ulimit -d unlimited -s unlimited -c 0
umask 002
echo -e "---------------------------------------------------------------"
date
echo -e "Begin setup of products needed"
setup dp 
echo -e "Done setup of products needed"
echo -e "---------------------------------------------------------------"
date
echo -e "PATH = $PATH"
echo -e "---------------------------------------------------------------"
date
printenv | grep _DIR | sort
echo -e "---------------------------------------------------------------"
echo -e "Kerberos Data: (klist -f)"
/usr/krb5/bin/klist -f
echo -e "---------------------------------------------------------------"
echo ---------------------------------------------------------------
date
if [ -f /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.log ]
then
    if [ -f /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.log.OLD ]
    then
      cat /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.log >> /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.log.OLD
      rm /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.log
    else
      mv /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.log /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.log.OLD
    fi
fi
if [ -f /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.err ]
then
    if [ -f /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.err.OLD ]
    then
      cat /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.err >> /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.err.OLD
      rm /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.err
    else
      mv /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.err /opdb/d1/data/tileChunk/chunk174/stuffCompleteTile.err.OLD
    fi
fi
date
setup ts v6_4 -f Linux+2.4-2.3.2 -z /sdss/ups/db
echo ---------------------------------------------------------------
date
echo Begin stuffing completeTile
ts -noTk -command "stuff_completeTile chunk174 hlin" 
if [ $? -ne 0 ]
then
  echo Error: Stuffing of completeTile for chunk chunk174 failed.
  exit 1
fi
echo Done stuffing completeTile
echo ---------------------------------------------------------------
date
echo ALL DONE
exit

