29 lines
687 B
Bash
Executable File
29 lines
687 B
Bash
Executable File
|
|
|
|
#HOME="/home/compegence/customer"
|
|
#Directories
|
|
fileDir="/data/customer/MMT"
|
|
homeDir=$HOME/customer/MMT
|
|
configDir=$homeDir/conf
|
|
input_file=$configDir/etl-config.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
|
|
|
|
user=${credentials[user]}
|
|
password=${credentials[password]}
|
|
host=${credentials[host]}
|
|
db=${credentials[db]}
|
|
protocol=${credentials[protocol]}
|
|
server=${credentials[server]}
|
|
|
|
postgres_con="psql -A -t postgresql://$user:$password@$host/$db"
|
|
|
|
|
|
count=`$postgres_con -c "select count(*) from staging1.temtable"`
|
|
|
|
echo $count
|
|
|