Erwin
2011-Mar-17 15:25 UTC
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 joinus-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org and unase-61u9bcnMqzP1P9xLtpHBDw@public.gmane.org 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 .. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Erwin
2011-Mar-17 17:34 UTC
Re: X-Files ? strange ! script behaves differently when running as cron task....
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/ruby-1.9.2-p136@rails3/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: <name of correct encoding>. now what should I do with it ? any complementary clue ? On 17 mar, 16:25, Erwin <yves_duf...-ee4meeAH724@public.gmane.org> wrote:> 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 > joi...-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org and un...-61u9bcnMqzP1P9xLtpHBDw@public.gmane.org > > 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 ..-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.