Sponsored Content
Top Forums UNIX for Advanced & Expert Users Issues while sending a mail having records fetched from SQL -all in UNIX Post 302333149 by DeepSalwan on Saturday 11th of July 2009 08:50:41 AM
Old 07-11-2009
Code is like
Code:
#######################################################################
# Starting the JOB
#######################################################################
#LIST=`ls ${LOG_HM}/${JOB_NM}*.*`

echo "JOB:$JOB_NM started at $DATETIME_NOW" > ${LOGFILE} 2>&1
echo " " >> ${LOGFILE} 2>&1

######################################################################
# Setup Connection String for Connecting to Oracle #
######################################################################
if [[ ! -a $HOME/.pass_]]; then
echo "Password File $HOME/.pass doesn't exist" >> ${LOGFILE} 2>&1
echo "Returning Non-Zero Code" >> ${LOGFILE} 2>&1
exit 1;
fi
USER=`cat $HOME/.pass | cut -d'/' -f1`
PASSWD=`cat $HOME/.pass_cdm | cut -d'/' -f2`
CONNECT_STRING=$USER/$PASSWD


ble.
#***********************************************************************

*******************************************
function Search_And_Mail_To_DS
{
sqlplus -s <<//
$CONNECT_STRING
set verify off
set heading off

COLUMN param FOLD_AFTER

SELECT trnsctn_nbr ,FRST_NM ,eml_adrs
FROM systm_usr
WHERE
UPDT_DT like sysdate


SET HEAD ON FEEDBACK ON VERIFY ON
COLUMN param CLEAR
PROMPT sql_complete
exit;


while read -p LINE
do
# Start setting variables based on return values
if print $LINE | grep @yahoo.com
then
INPUT_RECORD_SIZE=$(print $LINE | awk -F: '{print $2}')
continue

# Process any Oracle errors

elif print $LINE | grep x
then
print "Oracle error occurred"
exit 1

# Start setting variables based on return values
elif print $LINE | grep @
then
INPUT_RECORD_SIZE=$(print $LINE | awk -F: '{print $2}')
continue

# Look for our loop termination marker and break out when found
elif print $LINE | grep sql_complete
then
break


fi
done
//

if [ ${?} -ne 0 ]; then
echo "Failed To Connect To Oracle" >> ${LOGFILE} 2>&1
echo "Returning Non-Zero Code" >> ${LOGFILE} 2>&1
exit 1;
fi

}


#***********************************************************************

*****************************************
#archive_log_files $LIST
echo "Global IDs for which NULL values are passed from WFSAD while 

update" >> ${LOGFILE} 2>&1
echo 

"-----------------------------------------------------------------------

--" >> ${LOGFILE} 2>&1
Search_And_Mail_To_DS>> ${LOGFILE} 2>&1
echo

This code doesnt work

Last edited by vgersh99; 07-11-2009 at 10:05 AM.. Reason: code tags, PLEASE!
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sending mail from unix

Hi, I am using mailx command to send mail through Unix. But I am able to send mail only within my domain. If i want to send mail to some other server, it's not working. Like say If I want to send mail to someone on gmail or yahoo it's not working. but it's working fine within my company domain.... (3 Replies)
Discussion started by: anki_1
3 Replies

2. Shell Programming and Scripting

Sending mail in unix

Dear Friends, I have a shell script where the mail is being sent like this: /usr/lib/sendmail -v ${CPA_ADMIN} CPA_ADMIN="xx@abc.com" Can we specify more than one email ids in this variable? Is ther eany limit to the number of email ids I can specify in this variable, to whom the mail... (3 Replies)
Discussion started by: Radhe
3 Replies

3. Shell Programming and Scripting

Importing data from PL/SQL then sending it through mail,HELP ME!

Is anyone here know how to make a script in UNIX which will do importing data from PL/SQL then sending it through mail? Can you give me sample script with explanation so it's easy to understand,Thank you very much,any suggestion or advice is welcome, (1 Reply)
Discussion started by: Atrap
1 Replies

4. Shell Programming and Scripting

Executing SQL Query and sending a mail

Hi all, My reqirenet goes like this. Need to execute one select statement within the script and send a mail to the users with the number of records fecthed from the query. Please help.. Thanks. (3 Replies)
Discussion started by: Achiever
3 Replies

5. UNIX for Dummies Questions & Answers

issues in sending mail

Hi, i am trying the below script for sending mail. if then count=`cat $sfile|wc -l` echo "There are $count abends.Please take care " > body.txt (cat body.txt;uuencode $sfile $sfile) | mailx -s "Alert:there are failures" pandeesh@gmail.com fi In the mail, i am getting like: ... (4 Replies)
Discussion started by: pandeesh
4 Replies

6. UNIX for Dummies Questions & Answers

Issues in sending mail with attachements

Hi I am using the below command to send mail from unix with body as well as attachment. But the attachment is in encoded form in the body itself. I am not receiving as attachment: (cat body_success.txt;uuencode Log.txt Log.txt)| mailx -s "success" $ToID I am receiving... (5 Replies)
Discussion started by: pandeesh
5 Replies

7. UNIX for Dummies Questions & Answers

Sending e-mail from unix

Hello, I want to send an email from unix. I tried following commands: mailx -s "hello" manish.xxx@xxx.com < echo_manish and echo "Testing Mail" | mailx -s "hello" manish.xxx@xxx.com but in both the commands nothing is happening. I mean it is neither giving any error nor I am receiving... (7 Replies)
Discussion started by: manishdivs
7 Replies

8. Shell Programming and Scripting

Issues sending emails using PostFix Mail Server

I'm unable to send email from my Linux server despite SMTP port 25 Active and Listening. # hostname TechX I checked the mail log ( /var/log/maillog ) and found the below error. I'm sharing all the ".cf" files seen in the error log. 1. # more /etc/postfix/main.cf # postfix... (0 Replies)
Discussion started by: mohtashims
0 Replies
GNUNET-TESTING(1)					      General Commands Manual						 GNUNET-TESTING(1)

NAME
gnunet-testing - Command line tool to access the testing library. SYNOPSIS
gnunet-testing [options] DESCRIPTION
gnunet-testing is a command line tool to access the testing library. OPTIONS
-C, --cfg Create unique configuration files. -c FILENAME, --config=FILENAME Use the configuration file FILENAME. -H, --hostkeys Host key file. -h, --help Print short help on options. -k, --key Create hostkey files from pre-computed hostkey list. -L LOGLEVEL, --loglevel=LOGLEVEL Use LOGLEVEL for logging. Valid values are DEBUG, INFO, WARNING and ERROR. -l LOGFILE, --logfile=LOGFILE Configure logging to write logs to LOGFILE. -n, --number Number of unique configuration files or hostkeys to create. -t, --template Configuration template. -v, --version Print GNUnet version number. BUGS
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet-developers@gnu.org> GNUnet Jan 4, 2012 GNUNET-TESTING(1)
All times are GMT -4. The time now is 07:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy