SCIENTIFIC-LINUX-USERS Archives

July 2007

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
John Summerfield <[log in to unmask]>
Reply To:
John Summerfield <[log in to unmask]>
Date:
Fri, 13 Jul 2007 06:29:39 +0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (48 lines)
Manuel Mussini wrote:
> Hi,
> 
> is there a way to send an email from a bash script?
> 
> I mean . I have a script that manages some jobs that need many days to
> complete (they run locally on my desktop!)! I'd like to receive some emails
> containing the status of the job! Just like CAF's endjob mails!
> 
> Is it possible?

This doesn't give any control over the from: field; it's simply piped 
into sendmail. It mirrors what crond and atd do.

echo -e 'Love\n\tMaria' \
	| mail -s "Message for Manuel" [log in to unmask]

The following gives complete flexibility and is what I often do to send 
reports. Note that I have two sections here, one sending out the headers 
(including the needed blank line), one creating the actual report. This 
mirrors what is often needed in practice.

(
cat <<Z
To: [log in to unmask]
From: [log in to unmask]
Subject: Message from Maria

Z
echo Thanks so much for last night
echo
echo Love
echo -e \ Maria
) 2>&1 \
  | /usr/sbin/sendmail -t



-- 

Cheers
John

-- spambait
[log in to unmask]  [log in to unmask]

Please do not reply off-list

ATOM RSS1 RSS2