mmt sql
This commit is contained in:
@@ -1,7 +1,21 @@
|
||||
#!/bin/bash -e
|
||||
HOME="/home/compegence/customer"
|
||||
|
||||
#/****************************************************************
|
||||
#****** 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
|
||||
homeDir=$HOME/customer/MMT
|
||||
configDir=$homeDir/conf
|
||||
input_file=$configDir/etl-config.txt
|
||||
declare -A credentials
|
||||
@@ -22,7 +36,7 @@ server=${credentials[server]}
|
||||
psql_base_arg="postgresql://$user:$password@$host/$db"
|
||||
|
||||
# load the record into the fw_jobctl_runschedule accounting for run frequency (hourly, daily, monthly, yearly) and insert
|
||||
/home/compegence/customer/MMT/sql/scripts/job_load.sh
|
||||
$homeDir/sql/scripts/job_load.sh
|
||||
|
||||
##***** Run frequency loop; Outer Loop
|
||||
#while loop for each client_id,function_id,run_frequency from fw_jobctl_runschedule_jobstep
|
||||
@@ -78,10 +92,14 @@ echo "Executing Job: $job_name by checking Previous End Status"
|
||||
## Process java Program
|
||||
if [[ $job_script_type == "java" ]]; then
|
||||
psql $psql_base_arg -t -q -c "update fw_core.fw_jobctl_runschedule_jobstep set start_time=now(),begin_status='started' where job_step_script_name='$job_step_script_name' and client_id=$client_id and function_id=$function_id and run_frequency='$run_frequency' and latest_runschedule_flag='1' "
|
||||
echo "--$prev_job_seq"
|
||||
if [[ $prev_job_seq == '' ]]; then
|
||||
java -jar $job_step_script_name
|
||||
echo "calling java jar"
|
||||
java -jar $job_step_script_name
|
||||
|
||||
else
|
||||
chkrun=$(psql $psql_base_arg -t -c "select TRIM(end_status) from fw_core.fw_jobctl_runschedule_jobstep where latest_runschedule_flag='1' and job_step_run_dependency_seuqence=$prev_job_seq and client_id=21 and function_id=1;")
|
||||
chkrun=$(psql $psql_base_arg -t -c "select TRIM(end_status) from fw_core.fw_jobctl_runschedule_jobstep where latest_runschedule_flag='1' and job_step_run_dependency_seuqence=$prev_job_seq and client_id=20 and function_id=1;")
|
||||
echo "chk $chkrun"
|
||||
if [[ "$chkrun" == " success" ]]; then
|
||||
java -jar $job_step_script_name
|
||||
else
|
||||
@@ -95,7 +113,7 @@ echo "Executing Job: $job_name by checking Previous End Status"
|
||||
if [[ $prev_job_seq == '' ]]; then
|
||||
psql $psql_base_arg -a -f $job_step_script_name $host $port $user $pwd $dbname $param $client_id $function_id $data_from_date $data_to_date $job_scope $job_scope_qualifier
|
||||
else
|
||||
chkrun=$(psql $psql_base_arg -t -c "select TRIM(end_status) from fw_core.fw_jobctl_runschedule_jobstep where latest_runschedule_flag='1' and job_step_run_dependency_seuqence=$prev_job_seq and client_id=21 and function_id=1;")
|
||||
chkrun=$(psql $psql_base_arg -t -c "select TRIM(end_status) from fw_core.fw_jobctl_runschedule_jobstep where latest_runschedule_flag='1' and job_step_run_dependency_seuqence=$prev_job_seq and client_id=20 and function_id=1;")
|
||||
if [[ "$chkrun" == " success" && $file_count -gt 0 ]]; then
|
||||
psql $psql_base_arg -a -f $job_step_script_name $host $port $user $pwd $dbname $param $client_id $function_id $data_from_date $data_to_date $job_scope $job_scope_qualifier
|
||||
else
|
||||
@@ -109,7 +127,7 @@ echo "Executing Job: $job_name by checking Previous End Status"
|
||||
if [[ $prev_job_seq == '' ]]; then
|
||||
$job_step_script_name
|
||||
else
|
||||
chkrun=$(psql $psql_base_arg -t -c "select TRIM(end_status) from fw_core.fw_jobctl_runschedule_jobstep where latest_runschedule_flag='1' and job_step_run_dependency_seuqence=$prev_job_seq and client_id=21 and function_id=1;")
|
||||
chkrun=$(psql $psql_base_arg -t -c "select TRIM(end_status) from fw_core.fw_jobctl_runschedule_jobstep where latest_runschedule_flag='1' and job_step_run_dependency_seuqence=$prev_job_seq and client_id=20 and function_id=1;")
|
||||
|
||||
if [[ "$chkrun" == " success" && $file_count -gt 0 ]]; then
|
||||
$job_step_script_name
|
||||
@@ -125,7 +143,7 @@ echo "Executing Job: $job_name by checking Previous End Status"
|
||||
psql $psql_base_arg -c "select $job_step_script_name_concat"
|
||||
else
|
||||
|
||||
chkrun=$(psql $psql_base_arg -t -c "select TRIM(end_status) from fw_core.fw_jobctl_runschedule_jobstep where latest_runschedule_flag='1' and job_step_run_dependency_seuqence=$prev_job_seq and client_id=21 and function_id=1;")
|
||||
chkrun=$(psql $psql_base_arg -t -c "select TRIM(end_status) from fw_core.fw_jobctl_runschedule_jobstep where latest_runschedule_flag='1' and job_step_run_dependency_seuqence=$prev_job_seq and client_id=20 and function_id=1;")
|
||||
if [[ "$chkrun" == " success" && $file_count -gt 0 ]]; then
|
||||
psql $psql_base_arg -t -c "select $job_step_script_name_concat"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user