On Tue, Sep 03, 2013 at 12:41:08AM -0700, aavinash.behera wrote:
>
> Ubuntu 12.10 - Same in local & in production.
> Thin (1.5.1 codename Straight Razor) - Same in local & in production.
> Rails 3.2.8 - Same in local & in production.
> Ruby ruby 1.9.3p194(2012-04-20 revision 35410) [i686-linux] in local & ruby
> 1.9.3p448 (2013-06-27 revision 41675) in production
OK.
> > Could you please read
> >
https://gist.github.com/jmettraux/310fed75f568fd731814
> >
> > Then please give me details about your production environment.
> >
> > I cannot tell you now because you are not telling me what server you use
> > in
> > production (and perhaps I cannot tell you).
> >
> > If you could give me the link that says "rufus-scheduler works better with
> > Passenger"... I'd love to read that piece.
> >
>
> Sorry for this. They were previously using passenger so they have written
> for passenger.
So the article is not saying that rufus-scheduler works better on Passenger.
Great.
OK.
So this is your code:
```ruby
require 'rubygems'
require 'rufus/scheduler'
scheduler = Rufus::Scheduler.start_new
scheduler.cron '00 9 * * *' do
UserMailer.daily_message_report("some email").deliver
end
```
By the way, where do you put it?
...
Could you please try with?
```ruby
require 'rubygems'
require 'rufus/scheduler'
scheduler = Rufus::Scheduler.start_new
puts "0 - I'm in the schedule file..."
begin
UserMailer.daily_message_report("test email!").deliver
rescue => e
puts "vvv"
puts "cannot deliver mail"
puts
p e
puts e.message
puts
puts e.backtrace
puts "^^^"
end
scheduler.every '1m' do
puts "1 - rufus-scheduler is scheduling..."
end
scheduler.cron '00 9 * * *' do
begin
UserMailer.daily_message_report("some email").deliver
rescue => e
puts "vvv"
puts "something went wrong"
puts
p e
puts e.message
puts
puts e.backtrace
puts "^^^"
end
end
```
I wonder if the message 0 and the message 1 do appear in your console or in
your Rails log.
I wonder if your emails can be delivered...
Waiting for your feedback,