[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Send email when a error occurs

Ivan Vieira

3/30/2007 6:52:00 PM

I have a script in ruby that build a software for me once per day and
when the code is wrong and a error, I don't if the error has ocurred and
I don't know what happened.

I wanna know how I can saw the error, I want that this script tell me
what happenend by email.

Thanks,

Ivan

--
Posted via http://www.ruby-....

2 Answers

Rick DeNatale

3/30/2007 11:14:00 PM

0

On 3/30/07, Ivan Vieira <ivan.vieira@atan.com.br> wrote:
> I have a script in ruby that build a software for me once per day and
> when the code is wrong and a error, I don't if the error has ocurred and
> I don't know what happened.
>
> I wanna know how I can saw the error, I want that this script tell me
> what happenend by email.

Search for the docs on Net::SMTP in the ruby standard library.


--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denh...

Brian Candler

3/31/2007 8:41:00 AM

0

On Sat, Mar 31, 2007 at 03:52:29AM +0900, Ivan Vieira wrote:
> I have a script in ruby that build a software for me once per day and
> when the code is wrong and a error, I don't if the error has ocurred and
> I don't know what happened.
>
> I wanna know how I can saw the error, I want that this script tell me
> what happenend by email.

How are you running it daily? If running from cron, then cron should capture
your script's output and mail it to the cron user's uid.

Otherwise you could do something like
IO.popen("sendmail you@yourdomain.com","w") do |io|
io << EOM
From: system@yourhost
To: you@yourdomain.com

Something nasty has happened!
EOM
end

YMMV (you didn't say if this was Windows or Linux/Unix or something else)

B.