This commit is contained in:
dheepa
2021-10-28 09:12:13 +00:00
parent f3cf5e1d2d
commit 8402c9b738
74 changed files with 3883 additions and 908 deletions

60
scripts/correlation.sh Executable file
View File

@@ -0,0 +1,60 @@
#!/bin/bash -e
#/****************************************************************
#****** ForeWarn Licensing and / or usage Terms and Conditions *****
#ForeWarn. The NextGen Insights Solution Platform
#Copyright ¿ 2021 COMPEGENCE. All Rights Reserved
#ForeWarn is a product of COMPEGENCE.
#To be used only with a valid license from COMPEGENCE
#www.compegence.com info@compegence.com
#****************************************************************/
HOME="/home/compegence/customer"
#Directories
homeDir=$HOME/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 )
user=${credentials[user]}
password=${credentials[password]}
host=${credentials[host]}
db=${credentials[db]}
protocol=${credentials[protocol]}
server=${credentials[server]}
psql_base_arg="postgresql://$user:$password@$host/$db"
#update fw_jobctl_file_landing
##get file mnemonic count
file_mnemonic_count_drawbar=$(psql $psql_base_arg -t -c "select count(*) from fw_core.fw_jobctl_file_runschedule where latest_runschedule_flag=true and file_mnemonic like 'DB%' ;")
echo "file-mnemonic-count is $file_mnemonic_count_drawbar"
if [[ $file_mnemonic_count_drawbar -gt 0 ]]; then
psql $psql_base_arg -t -c "select fw_ods.drawbar_correlation_upload()"
# else
# exit 1;
fi
file_mnemonic_count_pto=$(psql $psql_base_arg -t -c "select count(*) from fw_core.fw_jobctl_file_runschedule where latest_runschedule_flag=true and file_mnemonic like 'PTO%';")
echo "file-mnemonic-count_pto is $file_mnemonic_count_pto"
if [[ $file_mnemonic_count_pto -gt 0 ]]; then
psql $psql_base_arg -t -c "select fw_ods.pto_correlation_upload()"
# else
# exit 1;
fi