Thursday, March 28, 2013

Email Concurrent Program Output

#REM ============================================================
#REM  Description: This Shell script program accepts request_id, email and Subject as argument
#REM                     and Send email with attachment of output file for the request

echo "Current Request :" $4
echo "Output Request :"$5
echo "Email :"$6
echo "Email Subject :"$7

fname=`sqlplus -s $1 <set head off
set feedback off
set verify off
select outfile_name from fnd_concurrent_requests
where request_id = $5

echo "File name from SQL :"$fname
fname=`ls $fname`
echo "Actual file name :" $fname
if [ -z "$fname" ]
        echo "No request matching id $5"
elif [ -s $fname ]
        echo "Getting output file: $fname"
 echo "Sending Email to :" $6
            /usr/bin/uuencode $fname "$5.out" | mailx -s "$7" $6

        echo "Either file $fname does not exist or it is of 0 bytes"

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.