Files
mmt_sql/scripts/post_update.sh
2021-10-28 09:12:13 +00:00

40 lines
1.3 KiB
Bash
Executable File

#!/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
psql $psql_base_arg -t -q -c "update fw_core.fw_jobctl_file_landing a set run_schedule_id=b.run_schedule_id,file_syspk=b.file_syspk,file_landing_date=b.file_landing_date,status=b.end_status from fw_core.fw_jobctl_file_runschedule b where a.file_name=b.file_name and b.latest_runschedule_flag=true;"