mmt sql
This commit is contained in:
@@ -1,9 +1,21 @@
|
||||
#!/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
|
||||
#****************************************************************/
|
||||
|
||||
|
||||
#!/bin/bash -e
|
||||
HOME="/home/compegence/customer"
|
||||
#HOME="/home/compegence/customer"
|
||||
#Directories
|
||||
homeDir=$HOME/MMT
|
||||
homeDir=$HOME/customer/MMT
|
||||
configDir=$homeDir/conf
|
||||
input_file=$configDir/etl-config.txt
|
||||
declare -A credentials
|
||||
@@ -43,7 +55,7 @@ sun="Mon"
|
||||
psql $psql_base_arg -q -c "update fw_core.fw_jobctl_file_sheet_runschedule set latest_runschedule_flag='0' where latest_runschedule_flag='1';"
|
||||
|
||||
#inserting into fw_core.fw_jobctl_runschedule
|
||||
chkrun=$(psql $psql_base_arg -t -c "select count(*) from fw_core.fw_jobctl_jobstep_master where client_id=21 and function_id=1 and run_frequency='daily' and active_flag=true;")
|
||||
chkrun=$(psql $psql_base_arg -t -c "select count(*) from fw_core.fw_jobctl_jobstep_master where client_id=20 and function_id=1 and run_frequency='daily' and active_flag=true;")
|
||||
if [[ $chkrun -gt 0 ]]; then
|
||||
psql $psql_base_arg -q -c "INSERT INTO fw_core.fw_jobctl_runschedule
|
||||
(client_id, function_id, run_schedule_timestamp, run_frequency, start_time, begin_status, created_by, updated_by, create_timestamp, update_timestamp)
|
||||
@@ -52,19 +64,19 @@ where active_flag='TRUE' group by client_id, function_id, run_frequency limit 1;
|
||||
|
||||
#check previous day job status in fw_jobctl_runschedule
|
||||
chkrun2=$(psql $psql_base_arg -t -c "select trim(end_status) from fw_core.fw_jobctl_runschedule where run_schedule_id = (
|
||||
select max(run_schedule_id) as max from fw_core.fw_jobctl_runschedule where latest_runschedule_flag='0' and client_id=21 and function_id=1);")
|
||||
select max(run_schedule_id) as max from fw_core.fw_jobctl_runschedule where latest_runschedule_flag='0' and client_id=20 and function_id=1);")
|
||||
|
||||
if [ "$chkrun2" != " error" ]; then
|
||||
|
||||
#Update fw_jobctl_runschedule
|
||||
psql $psql_base_arg -q -c "update fw_core.fw_jobctl_runschedule set begin_status='started' where client_id=21 and function_id=1 and run_frequency='daily' and latest_runschedule_flag='1' "
|
||||
psql $psql_base_arg -q -c "update fw_core.fw_jobctl_runschedule set begin_status='started' where client_id=20 and function_id=1 and run_frequency='daily' and latest_runschedule_flag='1' "
|
||||
else
|
||||
psql $psql_base_arg -q -c "update fw_core.fw_jobctl_runschedule set begin_status='started',end_status='error',end_status_note = 'previous day job failed' where client_id=21 and function_id=1 and run_frequency='daily' and latest_runschedule_flag='1' "
|
||||
psql $psql_base_arg -q -c "update fw_core.fw_jobctl_runschedule set begin_status='started',end_status='error',end_status_note = 'previous day job failed' where client_id=20 and function_id=1 and run_frequency='daily' and latest_runschedule_flag='1' "
|
||||
echo "welcome2"
|
||||
exit 1;
|
||||
fi
|
||||
else
|
||||
echo " No active job for daily for client_id=21"
|
||||
echo " No active job for daily for client_id=20"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user