Send email when a error occurs

I

Ivan Vieira

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
 
R

Rick DeNatale

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.
 
B

Brian Candler

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 (e-mail address removed)","w") do |io|
io << EOM
From: system@yourhost
To: (e-mail address removed)

Something nasty has happened!
EOM
end

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

B.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top