#!/bin/csh 
#
# Name: acs_image_command
#
# Purpose: Runs the CDBS delivery process for a set of ACS reference
#          file images.
#
#==========================================================================
# set constants
set delivery_type = "ACS_image"
set science_ref_dir = "/data/cdbs7/jref/"
set archive_class = "cdb"
#
#/data/cdbs1/work/image_command $delivery_type $science_ref_dir $archive_class
#
#
banner -- 
printf "You start your $delivery_type delivery process at:" 
date 
#
# Peform the CDBS part of the delivery (verification and db updates)
deliver_cdbs 
if ($status != 0) then
  printf "FAILURE of deliver_cdbs.\n\n"
  exit 1
endif
#
banner -- 
printf "...CDBS process done...Making links for delivery pick-up..."
cdbs_make_links
if ($status != 0) then
  printf "FAILURE of cdbs_make_links.\n\n"
  exit 1
endif
#
#banner --
#printf "...Now creating temp/ directory for archiving..." 
#mkdir temp/ 
banner -- 
printf "...Copying *fits files to $science_ref_dir ..." 
/bin/cp *fits  $science_ref_dir
if ($status != 0) then
  printf "FAILURE to copy to $science_ref_dir \n\n"
  exit 1
endif
#banner -- 
#printf "...Moving *fits files from $PWD to the .temp/ directory for archiving..." 
#/bin/mv *fits temp/  
#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 delivery process..."  
banner ---- 
printf "Process finished at:" 
date  
banner ....
