Did you know LQ has a Linux Hardware Compatibility List?
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, 11:10 AM   #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, 11:20 AM   #2
Senior Member
Registered: Mar 2004
Distribution: Slackware
Posts: 4,617

Rep: Reputation: 137Reputation: 137
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 11:26 AM.
Old 06-09-2005, 11:29 AM   #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 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

All times are GMT -5. The time now is 06:04 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