Thursday, 23 January 2014

Sample shell Script to send concurrent program output an email

#!/bin/ksh



# Parameters.
#----- Standard Parameters: -----#
p_oracle_id=`echo ${1}`
USER_ID=`echo ${2}`
ORACLE_USER=`echo ${3}`
REQUEST_ID=`echo ${4}`
#----- User Parameters: -----#
P_REQUEST_ID=`echo ${5}`
 

v_requestid=$P_REQUEST_ID

echo "v_requestid: "$v_requestid

x=`sqlplus -s $p_oracle_id <<EOF
set feedback off set echo off head off pagesize 0 trimspool on linesize 1000
set heading off
spool temp.txt
SELECT  OUTFILE_NAME
FROM    fnd_concurrent_requests
WHERE   request_id   = $v_requestid;
EXIT;
spool off; 
EOF`


lv_body="Email_body.txt"
echo "Please find the attached log file for xxxx AR Oracle Outbound Interface To xxxx Data Feed." > $lv_body
echo "" >> $lv_body
echo "Please take appropriate action if this is not as expected." >> $lv_body

#mutt  $lv_out_file_path -s "$lv_new"  $TO_ADDRESS < $lv_body1
mutt -a $x -s "Oracle Outbound Interface to xxx Data feed is completed with Error/Warning status" reddi.info@gmail.com < $lv_body

rm $lv_body


--