User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,568 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,604 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 1899 | Replies: 2
Reply
Join Date: Oct 2007
Posts: 2
Reputation: tamilmercy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tamilmercy tamilmercy is offline Offline
Newbie Poster

How I can write shell script for Sending Email

  #1  
Oct 23rd, 2007
I tried to Sends email but somehow email not getting out, please help me how I can write shell script in right manner. Thanks and regards

This is the one I tried my end.


Script:
#!/bin/sh
set wma = `grep -i "java" sampletest`
echo $wma
mail -v -s "ALERT" tamilmercy@yahoo.com < alertfile


Result:
r.invoke.InvokeManager.process(InvokeManager.java:612) :i
tamilmercy@yahoo.com... Connecting to [127.0.0.1] via relay...
tamilmercy@yahoo.com... Deferred: Connection refused by [127.0.0.1]
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Posts: 306
Reputation: eggi is on a distinguished road 
Rep Power: 2
Solved Threads: 29
eggi eggi is offline Offline
Posting Whiz

Re: How I can write shell script for Sending Email

  #2  
Oct 24th, 2007
Hey There,

The last line of your script is actually okay. The error you're getting looks like it's coming from sendmail. Depending on what version you're running you may need to edit /etc/mail/sendmail.cf or /etc/mail/submit.cf and specify the IP of the host in DaemonPortOptions - It's either that or ClientPortOptions.

In any event, your script is okay. Looks like sendmail won't send mail no matter what you do right now.

If you invoke
/usr/lib/sendmail -v tamilmercy@yahoo.com

and can post that output, I might be able to tell you what you need to do to make your mail work

Also - you can run
/usr/lib/sendmail -vb tamilmercy@yahoo.com
if you want to get the verbose output but not actually send the mail.

Thanks

, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
Reply With Quote  
Join Date: Oct 2007
Posts: 2
Reputation: tamilmercy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tamilmercy tamilmercy is offline Offline
Newbie Poster

Re: How I can write shell script for Sending Email

  #3  
Oct 25th, 2007
Thanks for your kind reply. I like to write script as follow:

The script to be checked

- “error” message in current server log file
- If found error message than send alert email to system admin email address



I need to be checked on current date -<serverYYMMDD.log> file under log directory if anything “error” message appeared.

please help me out how I can write this type of script. Thanks
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Shell Scripting Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 5:56 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC