[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 530
  • Last Modified:

Script in the server is sending mail to the oracle@<servername.domain> instead of the list of persons in the script

We have lotus Notes in the company and ther diferent unix and solaris servers send through this Lotus Notes Mail server to the emails we want.
I have the following script and it is running, but it is sending an email to himself in Lotus Notes and the Lotus Notes Administrator told me to check the script:

ORACLE_SID=SCOREDEV
export ORACLE_SID
echo $ORACLE_SID
HOME=/home/app
export HOME
PATH=/home/app/oracle/product/10.1.0/bin:/usr/ccs/bin:/usr/bin:/etc:/usr/openwin
/bin:/usr/local/bin
export PATH
ORACLE_HOME=/home/app/oracle/product/10.1.0
export ORACLE_HOME
NLS_LANG=American_America.WE8ISO8859P1;export NLS_LANG
date
cat /home/app/dba/exports/exp_pipe.dmp | compress > /home/app/dba/exports/scored
ev.dmp.Z &
exp backup_user/backup_user file=/home/app/dba/exports/exp_pipe.dmp compress=y f
ull=y statistics=none log=/home/app/dba/logs/exp_db_scoredev.log
#dsmc incremental /home/app/dba/exports/scoredev.dmp.Z
date
cd /home/app/dba/logs
log=exp_db_scoredev.log
egrep "ORA-|rejected|Killed|EXP-" $log >/dev/null 2>&1 && cat $log | mailx -s "S
COREDEV export with error" <person#1>@<domain.net>  <person#2>@<domain.net> <person #3>@<domain.net> <person #4>@<domain.net> <person#5>@<domain.net>
<person#6>@<domain.net>

scoredevdb(oracle)#

The email sent is this:

Oracle Account <oracle@scoredevdb.intra.prtc.net>
03/29/2006 02:11 AM      
To
oracle@scoredevdb.intra.prtc.net
cc

Subject
Output from "cron" command

And the body is the export log.      

      
0
LindaC
Asked:
LindaC
  • 4
  • 3
  • 2
  • +2
1 Solution
 
NukfrorCommented:
That's means the mailx command in your script is never executed - so something is up with the line:

egrep "ORA-|rejected|Killed|EXP-" $log >/dev/null 2>&1 && cat $log | mailx -s "SCOREDEV export with error" <person#1>@<domain.net>  <person#2>@<domain.net> <person #3>@<domain.net> <person #4>@<domain.net> <person#5>@<domain.net> <person#6>@<domain.net>

If a crontab job throws any STDOUT or STDERR output, cron will automatically send the user that owns the jobs an email showing the output with a SUBJECT line exactly as you're shown.  So cron is doing exactly what its supposed to do.  It apparently looks that the logic in your script that isn't working.  The logic looks like it should work.

You might try changing it to look like this:

egrep -s "ORA-|rejected|Killed|EXP-" $log && cat $log | mailx -s "SCOREDEV export with error" <person#1>@<domain.net>  <person#2>@<domain.net> <person #3>@<domain.net> <person #4>@<domain.net> <person#5>@<domain.net> <person#6>@<domain.net>

and see if this changes the behavior at all.
0
 
bpeterseCommented:
Try editing /etc/mail/aliases and add an alias in that file for Oracle that points to a real email address.

Another tack is to export a var that replaces all the email addresses. e.g.
>ORACLE_SID=SCOREDEV
>export ORACLE_SID
export MAILMEN=<person#1>@<domain.net>,<person#2>@<domain.net>,<person #3>@<domain.net>,<person #4>@<domain.net>,<person#5>@<domain.net>
....

egrep "ORA-|rejected|Killed|EXP-" $log >/dev/null 2>&1 && cat $log | mailx -s "S
COREDEV export with error" $MAILMEN

I assume you already have your mailhost/mail server listed in /etc/hosts.

Still another tack is to have a Distribution List in Lotus Notes as an alias to the oracle user - I find it interesting that the mail server has an "oracle" user account.

hth
/bp/
0
 
arnoldCommented:
If you have sendmail, postfix, qmail, exim installed on the local system, you might be better off using those instead of an email client like mailx (X-window) or mail to send messages out.
The script to do that is fairly simple.

ie. you build up the header and the body of the message.
i.e.
messages="To: <someemailaddress>
From: <someemailaddress>
Subject: Somesubject

Something
"
echo $message | sendmail -oi -fenvelope_sender_email -t

The system reference to sendmail is often consistent but would use the mail app installed on the system.

This provides you more control on formating and content of the email and does not involve and indermediery email client that might not do what you expect.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LindaCAuthor Commented:
Nukfor - I changed the script to your suggestion yesterday, but today I receive another "friendly email" from our System Administrator telling me that again they receive in the Lotus Notes a mail to oracle@scoredevdb...

Arnold, we don't have sendmail because I  don't see a /etc/default/sendmail file anywhere there.

bpeterse:  We do have the entry to the mail in the /etc/hosts, that is why the System Adminsitrator email me telling me that in Lotus Notes they receive the mail from oracle@scoredevdb.. sititing there in Lotus Notes because it pointed to nobody.

I don't know why it is not functioning in this particular server because in all 100...other servers it is functioning well both solaris and unix.
There is something not quite well here and I count with one of you to find the hidden so much tresured answer to this puzzle.
0
 
arnoldCommented:
sendmail is just the common reference.

what does mailx/mail use to inject the email into a queue on the local system?

Is the script running in the same shell as on the servers where it does work.

If you are logged in on this server, and perform a similar
cat message | mailx  with the same parameters
what happens?
0
 
LindaCAuthor Commented:
Arnold:  I'am an oracle dba I am not a System Administrator.  So I do not understand the question:  what does mailx/mail use to inject the email into a queue on the local system?.  Please give me specific instructions that I can type in the solaris box.

About the Shell:

In socredevdb where the sending of the mail to oraacle@scoredev to Lotus Notes occurs even though there is no errors in the log:

oracle:x:100:100:Oracle Account:/home/app:/bin/ksh

In scoreproddb where the sending of the mail to oracle@scoreproddb does not occur:

oracle:x:10001:102:Oracle Account:/export/home/oracle:/sbin/sh

About the test in the scoredevdb server, I went to the export log and type the following command as you instructed but I have not received any mail

cat exp_db_scoredev.log | mailx  -s  <mymail.com>

When I go to /var/mail the log for the oracle user is not there, see:

scoredevdb(oracle)#cd /var/mail
scoredevdb(oracle)#ls -lt
total 22290
-rw-rw----   1 root     mail     11395321 Feb 26 18:00 root
drwxrwxr-x   2 root     mail         512 Apr 14  2005 :saved
scoredevdb(oracle)#
0
 
arnoldCommented:
do you have a .forward file in your home dir?
see if you have a /var/log/maillog

If I am not mistaken, you need to designate the receipients of the email on the command line.

0
 
LindaCAuthor Commented:
arnold, first I tried again to execute the line   cat exp_db_scoredev.log | mailx  -s  "Test" <mymail.com>,  second, in the /var/log/   there is a syslog but not a maillog, which has a lot of this lines:

Apr  4 08:21:30 scoredevdb sendmail[23548]: [ID 801593 mail.info] k316Adjt001073
: to=<oracle@scoredevdb.intra.prtc.net>, delay=3+06:10:51, xdelay=00:07:30, mail
er=relay, pri=28008855, relay=mailhost.com [64.34.217.18], dsn=4.0.0, stat=Defer
red: Connection timed out with mailhost.com
Apr  4 08:21:31 scoredevdb sendmail[23592]: [ID 801593 mail.info] k326EEjt008057
: to=<oracle@scoredevdb.intra.prtc.net>, delay=2+06:07:17, xdelay=00:07:29, mail
er=relay, pri=19368854, relay=mailhost.com [64.34.217.18], dsn=4.0.0, stat=Defer
red: Connection timed out with mailhost.com
Apr  4 08:21:32 scoredevdb sendmail[23632]: [ID 801593 mail.info] k32Luvjt012482
: to=<oracle@scoredevdb.intra.prtc.net>, delay=1+14:24:35, xdelay=00:07:29, mail
er=relay, pri=13878854, relay=mailhost.com [64.34.217.18], dsn=4.0.0, stat=Defer
red: Connection timed out with mailhost.com
Apr  4 08:21:34 scoredevdb sendmail[23839]: [ID 801593 mail.info] k346DQjt021889
: to=<oracle@scoredevdb.intra.prtc.net>, delay=06:08:08, xdelay=00:07:29, mailer
=relay, pri=2358854, relay=mailhost.com [64.34.217.18], dsn=4.0.0, stat=Deferred
: Connection timed out with mailhost.com
scoredevdb(oracle)#
scoredevdb(oracle)#
0
 
LindaCAuthor Commented:
As I said before I run the test cat exp_db_scoredev.log | mailx  -s  "Test" <mymail.com>  but I did not receive any mail.
0
 
NukfrorCommented:
The messages you are seeing indicate sendmail can't talk to mailhost.com for some reason so you won't be getting any email from this system assumign the email is going outbound.  You need to figure out why you're getting the timeouts.
0
 
XoFCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: Nukfror

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

-XoF-
EE Cleanup Volunteer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now