#!/usr/bin/ksh
#
# gbo_ua_canmag_mirror_batch.ksh - Calls the main mirror script
# for ground mag data collected from UAlberta
#
#
# Creation Date:
#
#               1 May 2008 TimQuinn
#

#
## 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/gaia2_test/soc_it_to_me.config
#
## Determine dates to check
#
  thisYear=$(date -u '+%Y')
	thisMonth=$(date -u '+%m')
	integer ithisMonth=$thisMonth
	integer ilastMonth=$(( ithisMonth - 1 ))

	if (( $ilastMonth <= 0 ))
  then
    lastYear=$(( $thisYear - 1 ))
		/home/thmsoc/gaia2_test/gbo_ua_canmag_mirror_gaia.ksh $lastYear	
		/home/thmsoc/gaia2_test/gbo_ua_canmag_mirror_gaia.ksh $thisYear	
  else
		/home/thmsoc/gaia2_test/gbo_ua_canmag_mirror_gaia.ksh $thisYear
	fi

#
## Cleanup
#
  exit 0