Hello, I have a synchronization program built on InstantRails v1.6. I need to have an option that makes my program run daily at a certain time. Thus, I need a script or something that is constantly running and checking the time, then when the time is right, do the sync. Is there a way to do this with InstantRails? Any help is appreciated! Thanks, - Jeff Miller -- 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 -~----------~----~----~----~------~----~------~--~---
ESPNDev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-May-01 22:32 UTC
Re: Constantly Running a Script
Might want to read through some of these articles to set up a cron: http://www.google.com/search?client=safari&rls=en-us&q=cron+introduction&ie=UTF-8&oe=UTF-8 Then you could put the cron script in the ''script'' folder of your rails application and have it call whatever ruby file you need to run at a particular time. So for example, at 5 pm every night I want to write ''Closing Time!'' to the error log: Add this line to crontab to run at 5: 00 5 * * * root sh /path/to/your/rails/app/root/folder/foo.sh In the sh file: ruby script/foo.rb run And then in foo.rb you have whatever code you need, in our case: RAILS_DEFAULT_LOGGER.error(”\n Closing Time! \n”) Hope this helps! ESPNDev On May 1, 2:00 pm, Jeff Miller <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello, > I have a synchronization program built on InstantRails v1.6. I need to > have an option that makes my program run daily at a certain time. Thus, > I need a script or something that is constantly running and checking the > time, then when the time is right, do the sync. Is there a way to do > this with InstantRails? > > Any help is appreciated! > > Thanks, > - Jeff Miller > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
That''s more of an OS function than a rails function isn''t it? So--on windows that''d be a scheduled task. Or do I misunderstand the goal? -----Original Message----- From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Jeff Miller Sent: Thursday, May 01, 2008 2:00 PM To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails] Constantly Running a Script Hello, I have a synchronization program built on InstantRails v1.6. I need to have an option that makes my program run daily at a certain time. Thus, I need a script or something that is constantly running and checking the time, then when the time is right, do the sync. Is there a way to do this with InstantRails? Any help is appreciated! Thanks, - Jeff Miller -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I think Cron will work. I just have to flesh out everything around it before I test it. Thanks!! -- 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 -~----------~----~----~----~------~----~------~--~---
I"ve been using rufus-scheduler with great results. It serves the same function as cron (run a job periodically), but is portable to windows and is ruby-centric, and efficient on resources since it''s not reloading the rails environment each time a job runs. http://rufus.rubyforge.org/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''ve been trying to use the Rufus-Scheduler, but no luck so far with it. I have this in one of my controllers: scheduler.schedule "* #{params[:month_time]} #{params[:month_date]} * *" do `ruby script/push2exchange.rb run` end then the error I get is: Errno::ENOENT in AutosyncController#index No such file or directory - crontab -l I am running InstantRails 1.6 on Windows Server 2003. Is this error the result of it being on Windows? If so, how can I fix it? Any help is appreciated! Thanks, - Jeff Miller -- 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 -~----------~----~----~----~------~----~------~--~---