X-Files strange script behaves differently when running as cron task

I am running a ruby script ( 1.9.2, w Rails3 gems)
this script reads 2 different pop3 mailboxes then send back emails to
senders with a specific link in the email body…
for testing I send one email in each mailboxes
[email protected] and [email protected]

running the script in the server console is fine … the 2 mailboxes
are read, and each sender receives back the corresponding responses

then I created a cron task to run THIS same script every 5 min

/5 * * * * bash -c “source /usr/local/rvm/scripts/rvm && rvm
gemset use rails3 && /usr/bin/env ruby /var/www/…/current/jmy_app/
joinus_email.rb”

the script is launched correctly, my info log shows the notifier being
processed for each email as above , BUT only the first email response
is delivered…

as the script runs well in the console, I don’t know where to start
looking for some weird coding …
I have the following setup :

my_app_folder

  • joinus_email folder
    • joinus_email.rb
    • notifier folder
      -notifiers…html.erb

I defined the ActionMailer::Base.smtp_settings in the script
joinus_email.rb… from which I am building the emails and delivering
them

joinus_email.rb
require ‘action_mailer’
require ‘mail’

def send_email_back_to_sender(…)
mail = Notifier.joinus_email(…)
mail.deliver
end

any clue welcome …

First clue … running in the console … no error … but
when running the script as a cron task, I receive a message from the
cron daemon :

/usr/local/rvm/gems/[email protected]/gems/actionpack-3.0.5/lib/
action_view/template/handlers/erb.rb:129:in `valid_encoding’: Your
template was not saved as valid US-ASCII. Please either specify US-
ASCII as the encoding for your template in your text editor, or mark
the template with its encoding by inserting the following as the first
line of the template: (ActionView::Template::Error)

encoding: .

now what should I do with it ? any complementary clue ?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs