Script runs fine alone but not when called by cron (EPIPE)

Discussion in 'Ruby' started by Otto __, Oct 11, 2008.

  1. Otto __

    Otto __ Guest

    Hey, I'm still learning ruby (first week) and I'm having problem with a
    script that sends an e-mail.
    The script (~/teste_email.rb) runs fine when I call it, but raises and
    exception when ran as a cron task.

    This is the stack trace:
    ----------
    `write': Broken pipe (Errno::EPIPE)
    from /usr/lib/ruby/1.8/net/protocol.rb:139:in `<<'
    from /usr/lib/ruby/1.8/net/protocol.rb:139:in `rbuf_consume'
    from /usr/lib/ruby/1.8/net/protocol.rb:118:in `readuntil'
    from /usr/lib/ruby/1.8/net/protocol.rb:126:in `readline'
    from /usr/lib/ruby/1.8/net/smtp.rb:664:in `recv_response'
    from /usr/lib/ruby/1.8/net/smtp.rb:551:in `send0'
    from /usr/lib/ruby/1.8/net/smtp.rb:686:in `critical'
    from /usr/lib/ruby/1.8/net/smtp.rb:548:in `send0'
    ... 7 levels...
    from
    /var/lib/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:414:in
    `deliver'
    from /home/otto/send_gmail.rb:60:in `send_gmail'
    from /home/otto/teste_mail.rb:5:in `envia_email'
    from /home/otto/teste_mail.rb:8
    ----------


    I got send_gmail.rb from this website:
    http://codingfrenzy.alexpmay.com/2007/12/sending-gmail-from-standalone-ruby.html

    Why does it run fine when I call it myself and how do I make it run ok
    from cron?

    Thanks in advance
    --
    Posted via http://www.ruby-forum.com/.
    Otto __, Oct 11, 2008
    #1
    1. Advertising

  2. 2008/10/11 Otto __ <>:
    > Hey, I'm still learning ruby (first week) and I'm having problem with a
    > script that sends an e-mail.
    > The script (~/teste_email.rb) runs fine when I call it, but raises and
    > exception when ran as a cron task.
    >
    > This is the stack trace:
    > ----------
    > `write': Broken pipe (Errno::EPIPE)
    > from /usr/lib/ruby/1.8/net/protocol.rb:139:in `<<'
    > from /usr/lib/ruby/1.8/net/protocol.rb:139:in `rbuf_consume'
    > from /usr/lib/ruby/1.8/net/protocol.rb:118:in `readuntil'
    > from /usr/lib/ruby/1.8/net/protocol.rb:126:in `readline'
    > from /usr/lib/ruby/1.8/net/smtp.rb:664:in `recv_response'
    > from /usr/lib/ruby/1.8/net/smtp.rb:551:in `send0'
    > from /usr/lib/ruby/1.8/net/smtp.rb:686:in `critical'
    > from /usr/lib/ruby/1.8/net/smtp.rb:548:in `send0'
    > ... 7 levels...
    > from
    > /var/lib/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:414:in
    > `deliver'
    > from /home/otto/send_gmail.rb:60:in `send_gmail'
    > from /home/otto/teste_mail.rb:5:in `envia_email'
    > from /home/otto/teste_mail.rb:8
    > ----------
    >
    >
    > I got send_gmail.rb from this website:
    > http://codingfrenzy.alexpmay.com/2007/12/sending-gmail-from-standalone-ruby.html
    >
    > Why does it run fine when I call it myself and how do I make it run ok
    > from cron?


    You do not give near as much detail as needed to properly answer your
    question. Though chances are that the reason lies in different
    environments. Things to look for are PATH and LD_LIBRARY_PATH.

    Cheers

    robert


    --
    remember.guy do |as, often| as.you_can - without end
    Robert Klemme, Oct 13, 2008
    #2
    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. Replies:
    4
    Views:
    478
    Maett
    Jan 9, 2006
  2. Doug Morse
    Replies:
    10
    Views:
    977
    Thomas Heller
    Mar 16, 2008
  3. Saptarshi
    Replies:
    4
    Views:
    746
    Mark Space
    Feb 12, 2009
  4. Bryan
    Replies:
    3
    Views:
    1,011
    J Kenneth King
    Jul 27, 2009
  5. Bucker

    Runs Fine In Perl :: Not As Cron Job

    Bucker, Jan 15, 2007, in forum: Perl Misc
    Replies:
    6
    Views:
    173
    -berlin.de
    Jan 17, 2007
Loading...

Share This Page