Send email when a error occurs

Discussion in 'Ruby' started by Ivan Vieira, Mar 30, 2007.

  1. Ivan Vieira

    Ivan Vieira Guest

    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/.
    Ivan Vieira, Mar 30, 2007
    #1
    1. Advertising

  2. On 3/30/07, 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.


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


    --
    Rick DeNatale

    My blog on Ruby
    http://talklikeaduck.denhaven2.com/
    Rick DeNatale, Mar 31, 2007
    #2
    1. Advertising

  3. 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 ","w") do |io|
    io << EOM
    From: system@yourhost
    To:

    Something nasty has happened!
    EOM
    end

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

    B.
    Brian Candler, Mar 31, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter
    Replies:
    0
    Views:
    3,323
    Peter
    Jul 1, 2003
  2. Andy G

    Send email when error occurs

    Andy G, Mar 18, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    556
    Andy G
    Mar 18, 2005
  3. Anjan Bhowmik
    Replies:
    0
    Views:
    265
    Anjan Bhowmik
    May 16, 2008
  4. Geek
    Replies:
    3
    Views:
    129
  5. Replies:
    2
    Views:
    373
    Tintin
    Jan 5, 2007
Loading...

Share This Page