hi all, i haven''t used cron yet but now i want to use it and got some idea about cron from google but not exactly.. so i want to use cron in ruby on rails application. in application i want to fire some query everyday so where i should write the code for query so that when cron is run that query is also fire?? can any one please help me?? thanks, Preksha. -- Posted via http://www.ruby-forum.com/.
On Sat, Sep 19, 2009 at 12:33 AM, Preksha Patel <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> so i want to use cron in ruby on rails application. in application i > want to fire some query everyday so where i should write the code for > query so that when cron is run that query is also fire??Cron runs whatever you tell it too, wherever that is. :-) If you want to run something with the Rails app''s environment, you probably want to add the code to {RAILS_ROOT}/lib and invoke it via {RAILS_ROOT}/script/runner HTH! -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan
Hassan Schroeder wrote:> On Sat, Sep 19, 2009 at 12:33 AM, Preksha Patel > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> so i want to use cron in ruby on rails application. in application i >> want to fire some query everyday so where i should write the code for >> query so that when cron is run that query is also fire?? > > Cron runs whatever you tell it too, wherever that is. :-) > > If you want to run something with the Rails app''s environment, you > probably want to add the code to {RAILS_ROOT}/lib and invoke it > via {RAILS_ROOT}/script/runner > > HTH! > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassanhi, as you told to add the code to {RAILS_ROOT}/lib so you mean to say to add the code in lib folder, i have to make one file with extension is what?? and {RAILS_ROOT}/script/runner is the command which i should run?? i haven''t used corn before so can you please tell me something in detail?? thanks, Preksha.. -- Posted via http://www.ruby-forum.com/.
On Sun, Sep 20, 2009 at 8:56 PM, Preksha Patel <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> as you told to add the code to {RAILS_ROOT}/lib so you mean to say to > add the code in lib folder, i have to make one file with extension is > what?? and {RAILS_ROOT}/script/runner is the command which i should > run??~/projects/example$ more lib/whatever.rb class Whatever class << self def say_it puts "it, that''s all" end end end ~/projects/example$ script/runner Whatever.say_it it, that''s all ~/projects/example$> i haven''t used corn before so can you please tell me something in > detail??Have you read the man pages for cron and crontab? That should be enough examples to get you started, I''d think. :-) -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan
Hi Preksha Read this http://railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial Sijo -- Posted via http://www.ruby-forum.com/.
Hassan Schroeder wrote:> On Sun, Sep 20, 2009 at 8:56 PM, Preksha Patel > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> as you told to add the code to {RAILS_ROOT}/lib so you mean to say to >> add the code in lib folder, i have to make one file with extension is >> what?? and {RAILS_ROOT}/script/runner is the command which i should >> run?? > > ~/projects/example$ more lib/whatever.rb > class Whatever > class << self > def say_it > puts "it, that''s all" > end > end > end > ~/projects/example$ script/runner Whatever.say_it > it, that''s all > ~/projects/example$ > >> i haven''t used corn before so can you please tell me something in >> detail?? > > Have you read the man pages for cron and crontab? That should be > enough examples to get you started, I''d think. :-) > > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassanhi, i haven''t read man pages for cron or crontab...can you please help me for that??i mean from where i can read it?? can you please give me link?? thanks, Preksha.. -- Posted via http://www.ruby-forum.com/.
Sijo Kg wrote:> Hi Preksha > Read this > > http://railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial > > > > > Sijohi, thanks for giving this link..but is it for cron or crontab? thanks, Preksha.. -- Posted via http://www.ruby-forum.com/.
Hi> .but is it for cron or crontab?Did not get what you meant by this question. Anyway cron is a unix, solaris utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon And Crontab (CRON Table) is a file which contains the schedule of cron entries to be run and at specified times. After creating your rake tasks you can call it fron cron For that from console type crontab -e This will open the crontab file in edit mode There put your entries ne example from above link is 0 0 * * * cd /var/www/apps/rails_app/ && /usr/local/bin/rake RAILS_ENV=production utils:send_expire_soon_emails Sijo -- Posted via http://www.ruby-forum.com/.
Sijo Kg wrote:> Hi >> .but is it for cron or crontab? > > Did not get what you meant by this question. Anyway > > cron is a unix, solaris utility that allows tasks to be automatically > run in the background at regular intervals by the cron daemon > And > Crontab (CRON Table) is a file which contains the schedule of cron > entries to be run and at specified times. > > > After creating your rake tasks you can call it fron cron For that from > console type > crontab -e > This will open the crontab file in edit mode There put your entries > ne example from above link is > > 0 0 * * * cd /var/www/apps/rails_app/ && /usr/local/bin/rake > RAILS_ENV=production utils:send_expire_soon_emails > > > hi,but what''s this?? 0 0 * * * cd /var/www/apps/rails_app/ && /usr/local/bin/rake RAILS_ENV=production utils:send_expire_soon_emails thanks, Preksha..> > Sijo-- Posted via http://www.ruby-forum.com/.
Preksha> but what''s this?? > 0 0 * * * cd /var/www/apps/rails_app/ && /usr/local/bin/rake > RAILS_ENV=production utils:send_expire_soon_emailsThis is how we setup cron entries. In this case what it means is Every midnight (12 am) go to the project root and run the rake task in production mode The task is send_expire_soon_emails under namespace utils Another cron example entry 5,10 0 10 * 1 rm /tmp/* this means At 12.05,12.10 every Monday & on 10th of every month clear tmp directory. Sijo -- Posted via http://www.ruby-forum.com/.
On Sun, Sep 20, 2009 at 11:27 PM, Preksha Patel <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> i haven''t read man pages for cron or crontab...can you please help me > for that??i mean from where i can read it?? can you please give me > link??<http://en.wikipedia.org/wiki/Man_page> HTH, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan
Hassan Schroeder wrote:> On Sun, Sep 20, 2009 at 11:27 PM, Preksha Patel > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> i haven''t read man pages for cron or crontab...can you please help me >> for that??i mean from where i can read it?? can you please give me >> link?? > > <http://en.wikipedia.org/wiki/Man_page> > > HTH, > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassanhi, why you have given me this link??it is about man command for UNIX.. -- Posted via http://www.ruby-forum.com/.
Preksha Patel wrote:> Hassan Schroeder wrote: >> On Sun, Sep 20, 2009 at 11:27 PM, Preksha Patel >> <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >>> i haven''t read man pages for cron or crontab...can you please help me >>> for that??i mean from where i can read it?? can you please give me >>> link?? >> >> <http://en.wikipedia.org/wiki/Man_page> >> >> HTH, >> -- >> Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >> twitter: @hassan > > hi, > > why you have given me this link??it is about man command for UNIX..hi, Which things are necessary for cron and crontab..i mean what i suppose to do for that?? -- Posted via http://www.ruby-forum.com/.
Preksha Patel wrote:> Hassan Schroeder wrote: > >> On Sun, Sep 20, 2009 at 11:27 PM, Preksha Patel >> <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> >>> i haven''t read man pages for cron or crontab...can you please help me >>> for that??i mean from where i can read it?? can you please give me >>> link?? >>> >> <http://en.wikipedia.org/wiki/Man_page> >> >> HTH, >> -- >> Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >> twitter: @hassan >> > > hi, > > why you have given me this link??it is about man command for UNIX.. >I imagine that he''s passed you that link so that you can learn how to use man and then read the documentation for cron/ crontab. Cheers, Mohit. 9/22/2009 | 12:51 PM.
On Mon, Sep 21, 2009 at 9:51 PM, Mohit Sindhwani <mo_mail-RxrYI66vbj0AvxtiuMwx3w@public.gmane.org> wrote:>> why you have given me this link??it is about man command for UNIX.. >> > I imagine that he''s passed you that link so that you can learn how to > use man and then read the documentation for cron/ crontab.Bingo :-) -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan
Preksha Patel wrote:> Preksha Patel wrote: >> Hassan Schroeder wrote: >>> On Sun, Sep 20, 2009 at 11:27 PM, Preksha Patel >>> <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >>> >>>> i haven''t read man pages for cron or crontab...can you please help me >>>> for that??i mean from where i can read it?? can you please give me >>>> link?? >>> >>> <http://en.wikipedia.org/wiki/Man_page> >>> >>> HTH, >>> -- >>> Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >>> twitter: @hassan >> >> hi, >> >> why you have given me this link??it is about man command for UNIX.. > > hi, > > Which things are necessary for cron and crontab..i mean what i suppose > to do for that??hi, one day you told me to follow using following code: ~/projects/example$ more lib/whatever.rb> class Whatever > class << self > def say_it > puts "it, that''s all" > end > end > end > ~/projects/example$ script/runner Whatever.say_it > it, that''s all > ~/projects/example$i made this file and add this method but don''t i need to make a page for say_it method?? how can i come to know that this cron is working i mean where this message "it, that,s all" will display?? -- Posted via http://www.ruby-forum.com/.
Sijo Kg wrote:> Hi >> .but is it for cron or crontab? > > Did not get what you meant by this question. Anyway > > cron is a unix, solaris utility that allows tasks to be automatically > run in the background at regular intervals by the cron daemon > And > Crontab (CRON Table) is a file which contains the schedule of cron > entries to be run and at specified times. > > > After creating your rake tasks you can call it fron cron For that from > console type > crontab -e > This will open the crontab file in edit mode There put your entries > ne example from above link is > > 0 0 * * * cd /var/www/apps/rails_app/ && /usr/local/bin/rake > RAILS_ENV=production utils:send_expire_soon_emails > > hi,where i supposed to write this: 0 0 * * * cd /var/www/apps/rails_app/ && /usr/local/bin/rake> RAILS_ENV=production utils:send_expire_soon_emailsi mean the code to fire an event at particular time tht where i supposed to write?> > > Sijo-- Posted via http://www.ruby-forum.com/.
Hey, Checkout ''whenever''. Just used it for one of my projects. Worked nicely, easily. All ruby, no fuss or weird cron job strings. http://github.com/javan/whenever http://github.com/javan/whenever/blob/master/README.rdoc http://wiki.github.com/javan/whenever/instructions-and-examples Or if you do better with screencasts: http://railscasts.com/episodes/164-cron-in-ruby Hope this helps. Regards Kieran On Sep 19, 7:33 pm, Preksha Patel <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> hi all, > > i haven''t used cron yet but now i want to use it and got some idea > about cron from google but not exactly.. > so i want to use cron in ruby on rails application. in application i > want to fire some query everyday so where i should write the code for > query so that when cron is run that query is also fire?? > > can any one please help me?? > > thanks, > Preksha. > -- > Posted viahttp://www.ruby-forum.com/.
Kieran P wrote:> Hey, > > Checkout ''whenever''. Just used it for one of my projects. Worked > nicely, easily. All ruby, no fuss or weird cron job strings. > > http://github.com/javan/whenever > http://github.com/javan/whenever/blob/master/README.rdoc > http://wiki.github.com/javan/whenever/instructions-and-examples > > Or if you do better with screencasts: > > http://railscasts.com/episodes/164-cron-in-ruby > > Hope this helps. > > Regards > Kieran > > > On Sep 19, 7:33�pm, Preksha Patel <rails-mailing-l...@andreas-s.net>Hey, what you are trying to tell me that i did not get you but will check these links..if possible tell me what you were telling?? -- Posted via http://www.ruby-forum.com/.
Preksha, Did you take any effort to learn what cron is? Did you do Internet search? Anyway, I don''t think it''s anyway related to rails now, you need to read man pages for cron (available on Internet). And you will know what Kieran is trying to tell if you click on those links and read. -- Abhinav On Wed, Sep 23, 2009 at 9:22 AM, Preksha Patel < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Kieran P wrote: > > Hey, > > > > Checkout ''whenever''. Just used it for one of my projects. Worked > > nicely, easily. All ruby, no fuss or weird cron job strings. > > > > http://github.com/javan/whenever > > http://github.com/javan/whenever/blob/master/README.rdoc > > http://wiki.github.com/javan/whenever/instructions-and-examples > > > > Or if you do better with screencasts: > > > > http://railscasts.com/episodes/164-cron-in-ruby > > > > Hope this helps. > > > > Regards > > Kieran > > > > > > On Sep 19, 7:33�pm, Preksha Patel <rails-mailing-l...@andreas-s.net> > Hey, > > what you are trying to tell me that i did not get you but will check > these links..if possible tell me what you were telling?? > -- > 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 -~----------~----~----~----~------~----~------~--~---
Abhinav Saxena wrote:> Preksha, > > Did you take any effort to learn what cron is? Did you do Internet > search? > Anyway, I don''t think it''s anyway related to rails now, you need to read > man > pages for cron (available on Internet). And you will know what Kieran is > trying to tell if you click on those links and read. > > -- > Abhinav > > On Wed, Sep 23, 2009 at 9:22 AM, Preksha Patel <have already read it and tried to implement cron also.. thanks, Preksha -- Posted via http://www.ruby-forum.com/.