#!/bin/bash
# Script to transfer all data from Progress PACE database into the MySQL
# PACE database.  This is meant to be run from a crontab entry.

cd /amduus/data_dump
rm -f *

# Since we dump and load the entire database, we simply drop the
# DB in MySQL and recreate the schema.

/amduus/pro2myv2/exportschema.bash -dlc /usr/dlc -pf /amduus/pro2myv2/pace.pf -table all
mysql -u root < *SQL

# Here we are actually dumping the data for loading into the DB

/amduus/pro2myv2/exportalldata.bash

for i in $(cat /amduus/pro2myv2/filelist)
do

  if [ -f /amduus/data_dump/$i.SQL ]
  then 

    mysql -u root < /amduus/data_dump/$i.SQL

  fi

done

exit 0

