LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-09-2005, 11:10 AM   #1
disorderly
Member
 
Registered: Sep 2003
Location: NJ
Distribution: RHEL5
Posts: 154

Rep: Reputation: 30
sending mail from command line won't work


hello!
i've been experimenting writing some shell scripts to monitor our different systems and now i've added a line to email me if the server doesn't respond:
Code:
mail -s "Server Problem $HOST $DATE" $MAIL
where $mail is my admin@site.com address. i've also tried it from the command line but it just hangs and now i can't even kill the process
any ideas?
thanks,
drGiggles
 
Old 06-09-2005, 11:20 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
It does not hang, it is normal behaviour of mail command
it waits for user input so you can type your message
you end your message by typing ctrl-d

Also if you want use it in a script, try :
Code:
cat <<END | mail -s "Server Problem $HOST $DATE" $MAIL
server:  $HOST
date: $DATE

add more...
END

Last edited by keefaz; 06-09-2005 at 11:26 AM.
 
Old 06-09-2005, 11:29 AM   #3
disorderly
Member
 
Registered: Sep 2003
Location: NJ
Distribution: RHEL5
Posts: 154

Original Poster
Rep: Reputation: 30
excellent! it worked perfectly!
thanks for your quick reply!
i'll be putting this script to very good use today
- disorderly
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
command-line email sending ixion Linux - Software 9 08-01-2008 06:46 AM
Sending an attachment from a command line RonnyNussbaum Linux - Software 12 06-04-2007 11:47 AM
command-line for sending email with attachment? enemorales Linux - Software 3 10-06-2004 08:04 AM
sending msgs thru command line citrus Linux - Software 3 04-13-2004 02:39 AM
Sending Email's from command line jlaruffa Linux - Newbie 0 06-04-2003 03:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration