Need help to write to log file whether the shell script call pass fail

I have the below script triggered daily at 330am in the morning, since last 7 days job not writing anything to database.

below impala shell calling shell file which has sql , it is extracting data and loads to a flat file txt file. which is going wrong for last 1 week.

need help, echo statements writing to log, want to write to log write after impala shell call, whther the call is successful or not, if any exception want to write the error message details to log file.

echo "Start Time:" `date` >> $LOG_DIR/$log_file ##this line written to log file
echo "Process: code value sql " >> $LOG_DIR/$log_file  ##this line written to log file

echo " " >> $LOG_DIR/$log_file


ETL_STEP_HANDLE=`$TTPCONTROL/etl_open_call.sh stage_process.CODE_VALUE_SQL hadoop TTPhadoop hadoopsvc`

impala-shell -k -i svrhdpw03.mch.corp.int:21000 --quiet -f $SQL_DIR/load_m_dw_code_value.sql

###Right after above impala shell call, want to write to log whether pass or fail info with reason

ETL_STEP_HANDLE=`$TTPCONTROL/etl_close_call.sh $ETL_STEP_HANDLE SUCCESS 0 0 

Thanks a lot for the helpful info.

Without fully understanding what you are doing there, I can't see any "writing to log" after the third echo . If you think that etl_(open|close)_call.sh should log something and they don't, you'd need to post those...

Hi,

If you read this thread you'll find everything that you need, with a little modification there is a separate log shell - there is also an example of how to use it in a working shell script.

Regards

Gull04