The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-06-2009
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
log file when the script fails !

i have a script that will retrive some info from database. The script is working fine but i have to add new feature in it when the script fails or retrive null result it should reflect in the log file.

below the script AMR_Inactive.sh
Code:

while read i
do

connect1=`sqlplus -silent amit/qwerty@edna.world <<END
set pagesize 0 feedback off verify off heading off echo off
SELECT meter.X_UDC_ASSET_ID
 FROM
    SIEBEL.S_ASSET Meter,
    SIEBEL.S_ASSET SDP,
    SIEBEL.s_asset_rel ARSM,
        SIEBEL.S_ADDR_PER Premise,
        SIEBEL.S_ASSET Route,
        SIEBEL.s_asset_rel ARSR
 WHERE
        ARSM.par_asset_id = SDP.row_id AND
        ARSM.asset_id = Meter.row_id AND
        ARSM.relation_type_cd = 'SDP-METER' AND
        ARSM.x_rel_status = 'Active' AND
     SDP.PER_ADDR_ID = Premise.row_id AND
        ARSR.par_asset_id = Route.row_id AND
        ARSR.asset_id = SDP.row_id AND
        ARSR.relation_type_cd = 'ROUTE-SDP' AND
        ARSR.x_rel_status = 'Active' AND
                Premise.X_CLIENT_PRMSE_ID = '$i';
exit;
END`
echo "Completed for $i" 
echo "$connect1" 
done < TNS_AMRI_INACTIVE.txt
contents of TNS_AMRI_INACTIVE.txt
Quote:
0002034694
if suppose for this data the script returns null result i should get the info "No rows returned" in my log file.i m runnig the script using crontab

AMR_Inactive.sh > AMR_Inactive.log 2>&1

Last edited by ali560045; 01-06-2009 at 02:26 AM..