Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 06-09-2005, 12:10 PM   #1
Registered: Sep 2003
Location: NJ
Distribution: RHEL5
Posts: 154

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

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:
mail -s "Server Problem $HOST $DATE" $MAIL
where $mail is my 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?
Old 06-09-2005, 12:20 PM   #2
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
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 :
cat <<END | mail -s "Server Problem $HOST $DATE" $MAIL
server:  $HOST
date: $DATE

add more...

Last edited by keefaz; 06-09-2005 at 12:26 PM.
Old 06-09-2005, 12:29 PM   #3
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 07:46 AM
Sending an attachment from a command line RonnyNussbaum Linux - Software 12 06-04-2007 12:47 PM
command-line for sending email with attachment? enemorales Linux - Software 3 10-06-2004 09:04 AM
sending msgs thru command line citrus Linux - Software 3 04-13-2004 03:39 AM
Sending Email's from command line jlaruffa Linux - Newbie 0 06-04-2003 04:31 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:54 AM.

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