latest_mmt_version

This commit is contained in:
Deepthi
2021-06-21 12:35:07 +05:30
parent 559fa36e6a
commit b4d396929e
425 changed files with 65022 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
#!/bin/bash -e
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 )
#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"
#echo $postgres_con
filesyspks=`$postgres_con -c "select file_syspk from fw_core.fw_jobctl_file_runschedule where latest_runschedule_flag='1';"`
for filesyspk in ${filesyspks}
do
dat=`$postgres_con -c "select file_name,end_status from fw_core.fw_jobctl_file_runschedule where file_syspk=$filesyspk"`
IFS="|" read name endstatus <<<$dat
filename=$(echo $name | sed 's/[[:space:]]/\\ /g' )
if [ $endstatus == "success" ]
then
filecount=$(ls $homeDir/files/processed/$filename |wc -l)
if [ $filecount == 0 ]
then
echo " moving file:$filename to processed folder"
mv $homeDir/files/landing/$filename $homeDir/files/processed/$filename
else
echo " moving file:$filename to duplicate folder"
mv -f $homeDir/files/landing/$filename $homeDir/files/duplicate_file/$filename
fi
else
errfilecount=$(find $homeDir/files/error_file/$filename -type f|wc -l)
if [ $errfilecount == 0 ]
then
echo "moving file: $filename to error file folder "
mv $homeDir/files/landing/$filename $homeDir/files/error_file/$filename
else
echo " moving file:$filename to duplicate folder"
mv -f $homeDir/files/landing/$filename $homeDir/files/duplicate_file/$filename
fi
fi
exit
done