latest_mmt_version
This commit is contained in:
65
MMT_latest_version/sql/old/run_onetime_individual.sh
Normal file
65
MMT_latest_version/sql/old/run_onetime_individual.sh
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash -e
|
||||
HOME="/home/jagadish"
|
||||
#Directories
|
||||
homeDir=$HOME/mmt
|
||||
configDir=$homeDir/conf
|
||||
input_file=$configDir/serverCredentials-postgres.txt
|
||||
declare -A credentials
|
||||
while IFS="=" read -r key value; do
|
||||
credentials[$key]=$value
|
||||
done < <( sed -e '/^\s*$/ d' -e '/^#/ d' $input_file )
|
||||
for i in ${credentials[@]}; do echo ***$i; done
|
||||
|
||||
trx_user=${credentials[trx_user]}
|
||||
trx_password=${credentials[trx_password]}
|
||||
trx_host=${credentials[trx_host]}
|
||||
trx_db=${credentials[trx_db]}
|
||||
trx_sch=${credentials[trx_sch]}
|
||||
trx_protocol=${credentials[trx_protocol]}
|
||||
trx_server=${credentials[trx_server]}
|
||||
staging2_user=${credentials[staging2_user]}
|
||||
staging2_password=${credentials[staging2_password]}
|
||||
staging2_host=${credentials[staging2_host]}
|
||||
staging2_db=${credentials[staging2_db]}
|
||||
staging2_sch=${credentials[staging2_sch]}
|
||||
staging2_protocol=${credentials[staging2_protocol]}
|
||||
staging2_server=${credentials[staging2_server]}
|
||||
|
||||
#satging path Dir
|
||||
path=$homeDir/onetime/createtables/staging
|
||||
path=$homeDir/onetime/dataloadfunctions/budni
|
||||
path=$homeDir/onetime/dataloadfunctions/Drawbar
|
||||
path=$homeDir/onetime/dataloadfunctions/IHT
|
||||
path=$homeDir/onetime/dataloadfunctions/field
|
||||
path=$homeDir/onetime/dataloadfunctions/PTO
|
||||
path=$homeDir/onetime/wrappers
|
||||
|
||||
#trx path Dir
|
||||
path=$homeDir/onetime/createtables/common
|
||||
path=$homeDir/onetime/createtables/control
|
||||
path=$homeDir/onetime/createtables/trx
|
||||
path=$homeDir/onetime/commonfunctions
|
||||
path=$homeDir/onetime/configentries
|
||||
|
||||
stgpostgres_con="psql -X -A -t postgresql://$staging2_user:$staging2_password@$staging2_host/$staging2_db?options=--search_path%3D$staging2_sch"
|
||||
trxpostgres_con="psql -X -A -t postgresql://$trx_user:$trx_password@$trx_host/$trx_db?options=--search_path%3D$trx_sch"
|
||||
|
||||
func_execute_conn(){
|
||||
local conn="$1"
|
||||
local -n param=$2
|
||||
for path in "${param[@]}"
|
||||
do
|
||||
for files in "$path"/*
|
||||
do
|
||||
$conn -f $files
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
#staging:
|
||||
declare -a stgpathvar=("$homeDir/onetime/createtables/staging")
|
||||
func_execute_conn "$stg_postgres_con" stgpathvar
|
||||
|
||||
#trx:
|
||||
#declare -a trxpathvar=("$homeDir/onetime/createtables/common" )
|
||||
#func_execute_conn "$trx_postgres_con" trxpathvar
|
||||
Reference in New Issue
Block a user