questions rufus scheduler

Hello people, I am using Rufus scheduler to send emails every day at 4am. To do this I am using:

scheduler = Rufus::Scheduler.start_new scheduler.every '1d', :first_at => '2010/04/1 04:30' do    #do something end

There is a better way to write this schedule ?

By the way, I placed this code at config/environments/production.rb, but don't seems to me that is the correct place. Is this the best way to go ?

Anderson Leite wrote:

Hello people, I am using Rufus scheduler to send emails every day at 4am. To do this I am using:

scheduler = Rufus::Scheduler.start_new scheduler.every '1d', :first_at => '2010/04/1 04:30' do    #do something end

There is a better way to write this schedule ?

By the way, I placed this code at config/environments/production.rb, but don't seems to me that is the correct place. Is this the best way to go ?

I created a file called config/initializers/task_scheduler.rb which looks like this:

scheduler = Rufus::Scheduler::PlainScheduler.start_new

scheduler.every "7m" do   sweep_for_reports   #puts "#{Time.now.to_s(:db)} -- Swept for reports." end

scheduler.cron '22 1 * * *' do   gather_event_data   puts "#{Time.now.to_s(:db)} -- Gathered data." end

Hm...seems like a better aproach... How about this schedule to run every day...is it correct? Looks like strange for me have to define the ":first_at" param...