#!/bin/csh 
#
# Name: acs_table_archive
#
# Purpose: Runs the archive process for a set of ACS reference
#          file tables.
#
#==========================================================================
# set constants
set delivery_type = "ACS_table"
set science_ref_dir = "/data/cdbs7/jref/"
set archive_class = "ctb"
#
#/data/cdbs1/work/image_command $delivery_type $science_ref_dir $archive_class
#
#
banner -- 
printf "You start your $delivery_type archive process at:" 
date 
#
# Peform the verification part of the process
verify_cdbs 
if ($status != 0) then
  printf "FAILURE of verify_cdbs.\n\n"
  exit 1
endif
#
banner --
printf "...Now creating temp/ directory for archiving..." 
mkdir temp/ 
banner -- 
printf "...Linking *fits files from $PWD to the .temp/ directory for archiving..." 
foreach i (*.fits)
  echo "linking $i"
  /bin/ln -n $i temp/$i
end
banner -- 
printf "...Change directory to temp/ ..." 
cd temp/  
banner -- 
printf "...Archiving to DADS... This may take sometime... Grab a cup of coffee..."  
banner ---- 
cdbs_make_request -a $archive_class
if ($status != 0) then
  printf "FAILURE of cdbs_make_request.\n\n"
  exit 1
endif
banner ----  
printf "...You have successfully finished the archive process..."  
banner ---- 
printf "Process finished at:" 
date  
banner ....
