How do you set up automated tasks on rails. Say I wanted to send an update mailing every night at midnight to my users, or every night connect to a external database to update information on my database? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi,> How do you set up automated tasks on rails. Say I wanted to send an > update mailing every night at midnight to my users, or every night > connect to a external database to update information on my database? >you can write a rake task and then invoke it with a cron-like tool (depending on your OS and preferences) writing rake tasks is pretty straight-forward. In your rails directory there are a lot of tasks you can take a look for getting the flavour of it. They are under vendor/rails/railties/lib/tasks regards, javier ramÃrez --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
Check out this great <a href = "http://www.railsenvy.com/2007/6/11/ ruby-on-rails-rake-tutorial">tutorial on using Rake for tasks</a> --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 10, 2:30 pm, Scott Pn <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> How do you set up automated tasks on rails. Say I wanted to send an > update mailing every night at midnight to my users, or every night > connect to a external database to update information on my database? > -- > Posted viahttp://www.ruby-forum.com/.Check out this great Rake tutorial: http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
dnstevenson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Aug-14 00:57 UTC
Re: scheduled tasks on rails
On Aug 10, 12:30 pm, Scott Pn <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> How do you set up automated tasks on rails. Say I wanted to send an > update mailing every night at midnight to my users, or every night > connect to a external database to update information on my database? > -- > Posted viahttp://www.ruby-forum.com/.I usually do something pretty simple: I create a class in the vendor directory, and then setup a cron job to run script\runner with that file. For example: I have a file called session_cleaner.rb in \vendor like this: class SessionCleaner CGI::Session::ActiveRecordStore::Session.destroy_all( [''updated_at < ?'', 240.minutes.ago] ) end Then I have a cron job that runs: ruby script\runner SessionCleaner -e production I''ve also used this method for nightly emails to process new user signups, etc. Dave http://www.gotossh.com - web based SSH http://www.stevensonsoftware.com - affordable VPS hosting --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---