Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Send email when a error occurs

Reply
Thread Tools

Send email when a error occurs

 
 
Ivan Vieira
Guest
Posts: n/a
 
      03-30-2007
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-forum.com/.

 
Reply With Quote
 
 
 
 
Rick DeNatale
Guest
Posts: n/a
 
      03-30-2007
On 3/30/07, Ivan Vieira <(E-Mail Removed)> 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.denhaven2.com/

 
Reply With Quote
 
 
 
 
Brian Candler
Guest
Posts: n/a
 
      03-31-2007
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 http://www.velocityreviews.com/forums/(E-Mail Removed)","w") do |io|
io << EOM
From: system@yourhost
To: (E-Mail Removed)

Something nasty has happened!
EOM
end

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

B.

 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send an email to my account whenever an exception/error of any type occurs? Anjan Bhowmik ASP .Net 0 05-16-2008 05:04 PM
Send email when error occurs Andy G ASP .Net 5 03-18-2005 04:01 PM
Can you intercept the url request before a 404 error occurs? =?Utf-8?B?UlVTU0VMTCBNQ0dJTk5JUw==?= ASP .Net 1 07-14-2004 02:45 PM
Get debugging to stop on line executing when error occurs Lloyd Sheen ASP .Net 3 03-07-2004 05:30 PM
Display error message if an error occurs on "open" command Geek Perl Misc 3 12-02-2003 11:04 PM



Advertisments