Atstone1997
Programmer
Hello, First time post
So I added logic to my script to write data to a log file to see how long my sql's are running within a script but the times come back the same even thought the sql takes several minutes. I was wondering if anyone else tried this solution
##-------------------------------------------------------------------------------------
#!/bin/ksh
export OUTPUT_PATH=/billing
set -A MONTHS Dec Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov
PATH_CURR_MONTH=`date +%m`
PATH_CURR_YEAR=`date +%Y`
PATH_PREV_MONTH=${MONTHS[$((PATH_CURR_MONTH -1))]}
mkdir -p $OUTPUT_PATH/$PATH_PREV_MONTH$PATH_CURR_YEAR
export BLGOUTPUT=$OUTPUT_PATH/$PATH_PREV_MONTH$PATH_CURR_YEAR
export PROGRESS_LOG=$BLGOUTPUT/track_progress.txt
echo `date +"%Y-%m-%d %H:%M:%S"` "Begin Script " >> $PROGRESS_LOG ##This works
dbaccess -e $DB_NAME <<-! >> $BLG_LOG 2>&1
!echo `date +"%Y-%m-%d %H:%M:%S"` "Begin DB Processing" >> $PROGRESS_LOG ##This works
Select * from table1 into temp tmpTable1 with no log; ##This runs for several minutes
!echo `date +"%Y-%m-%d %H:%M:%S"` "Begin DB Processing" >> $PROGRESS_LOG ##This works but the date and time are the same value as the last echo above
!
echo `date +"%Y-%m-%d %H:%M:%S"` "End Script " >> $PROGRESS_LOG ##This works and the time is several minutes later.
##-------------------------------------------------------------------------------------
I ran the ksh script with -x and what I notice is that all the echo commands within the dbaccess section execute even though the select script was still running.
Does anyone have an answer to this? I really don't want to use extra calls to the database to use the current command to set the timestamp
Thanks in advance
So I added logic to my script to write data to a log file to see how long my sql's are running within a script but the times come back the same even thought the sql takes several minutes. I was wondering if anyone else tried this solution
##-------------------------------------------------------------------------------------
#!/bin/ksh
export OUTPUT_PATH=/billing
set -A MONTHS Dec Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov
PATH_CURR_MONTH=`date +%m`
PATH_CURR_YEAR=`date +%Y`
PATH_PREV_MONTH=${MONTHS[$((PATH_CURR_MONTH -1))]}
mkdir -p $OUTPUT_PATH/$PATH_PREV_MONTH$PATH_CURR_YEAR
export BLGOUTPUT=$OUTPUT_PATH/$PATH_PREV_MONTH$PATH_CURR_YEAR
export PROGRESS_LOG=$BLGOUTPUT/track_progress.txt
echo `date +"%Y-%m-%d %H:%M:%S"` "Begin Script " >> $PROGRESS_LOG ##This works
dbaccess -e $DB_NAME <<-! >> $BLG_LOG 2>&1
!echo `date +"%Y-%m-%d %H:%M:%S"` "Begin DB Processing" >> $PROGRESS_LOG ##This works
Select * from table1 into temp tmpTable1 with no log; ##This runs for several minutes
!echo `date +"%Y-%m-%d %H:%M:%S"` "Begin DB Processing" >> $PROGRESS_LOG ##This works but the date and time are the same value as the last echo above
!
echo `date +"%Y-%m-%d %H:%M:%S"` "End Script " >> $PROGRESS_LOG ##This works and the time is several minutes later.
##-------------------------------------------------------------------------------------
I ran the ksh script with -x and what I notice is that all the echo commands within the dbaccess section execute even though the select script was still running.
Does anyone have an answer to this? I really don't want to use extra calls to the database to use the current command to set the timestamp
Thanks in advance