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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help to write to log file whether the shell script call pass fail
# 1  
Old 04-26-2016
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.

Code:
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.
# 2  
Old 04-27-2016
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...
# 3  
Old 04-27-2016
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to pass the config file lines as variable on the respective called function on a script

I want to make a config file which contain all the paths. i want to read the config file line by line and pass as an argument on my below function. Replace all the path with reading config path line by line and pass in respective functions. how can i achieve that? Kindly guide. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies

2. Shell Programming and Scripting

Unable to pass value from .Shell script to .SQL file

Hi All, I am new to shell script. I am trying to pass value from .sh file to .sql file . But I am able to run the .sql file from .sh file with values in sql file. But I am unable to pass the values from .sh file. can some one please help to resolve this. here is my .sh file s1.sh ... (4 Replies)
Discussion started by: reddy298599
4 Replies

3. Shell Programming and Scripting

How to write config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

4. UNIX for Dummies Questions & Answers

How to write Config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

5. Shell Programming and Scripting

Need to write shell script for my .sql file call

Hi Guys, I need to write a simple shell script which will generate a .csv file/report by calling .sql file inside a shell script. Can somebody help me on this. Thanks in advance! Regards, LK (7 Replies)
Discussion started by: lakshmanraok117
7 Replies

6. Shell Programming and Scripting

call another shell script and pass parameters to that shell script

Hi, I basically have 2 shell scripts. One is a shell script will get the variable value from the user. The variable is nothing but the IP of the remote system. Another shell script is a script that does the job of connecting to the remote system using ssh. This uses a expect utility in turn. ... (2 Replies)
Discussion started by: sunrexstar
2 Replies

7. Shell Programming and Scripting

Write script to call a file

Hello Experts, I have been trying to work on to call a file in scripts. @ECHO OFF call %MY_HOME%\bin\setvars.bat call %MY_HOME%\db\bin\start_db.bat. This is a batch file and i want to write same functionality in shell script. How should I achieve it? How should I set variables in a... (1 Reply)
Discussion started by: rajuchacha007
1 Replies

8. Shell Programming and Scripting

Call java program from shell and pass values

Hi All, Can anybody please help me with how can i call my java program from shell and also pass parameter along with it so that the program can interpret the value/int and update the database. Thanks in advance Neha (1 Reply)
Discussion started by: Neha Goyal
1 Replies

9. Shell Programming and Scripting

Need to return fail or pass from shell script on the basis of pl/sql code execution

Hi guys, I am quite new in shell scripting. I am tring to promote some oracle jobs into control-M. In control-M, I am calling a script which establishes a connection with database and execute some procedures. Now I want if that PL/sql Block got failed script should return failure to... (2 Replies)
Discussion started by: alok1301
2 Replies

10. Shell Programming and Scripting

shell script to remove old files and write to a log file

Hi, I have a script that works on a unix box but am trying to get it working on a linux box that uses shell. I am not a programmer so this is proving harder than I imagined. I made some changes and ended up with the script below but when I run it I get the following messages. Any help would be... (4 Replies)
Discussion started by: yabai
4 Replies
Login or Register to Ask a Question