#!/usr/bin/ksh

## Set the environment variables
#
  if [[ -z $THMSOC ]]
  then
    THMSOC=/disks/socware/thmsoc_dp_current
    export THMSOC
  fi
 # . ${THMSOC}/src/config/soc_it_to_me.config
  . /home/thmsoc/astraea2_test/soc_it_to_me.config
#  . ${THMSOC}/src/config/ground_mag.config
  . /home/thmsoc/astraea2_test/ground_mag_test.config

## Process sites
#
	for line in $(cat ${CONFIGDIR}/maccs_site_list.txt)
	do
		maccs_name=$(echo $line |awk -F_ '{print $2}')
		gbo_name=$(echo $line |awk -F_ '{print $1}')
		rm -f ${LOCAL}/gmag_raw_maccs_${gbo_name}.txt
		find ${MACCS_MIRROR_HOME} -name ${maccs_name}\*sec -exec /bin/basename {} \; | awk -F_ '{print substr($1,4,8)}' | sort >> ${LOCAL}/gmag_raw_maccs_${gbo_name}.txt
		mv -f ${LOCAL}/gmag_raw_maccs_${gbo_name}.txt ${FILELISTS}/gmag_raw_maccs_${gbo_name}.txt
	done

#
## Cleanup
#
	exit 0
