I''m currently using net/http to get my flickr data and displaying it on my site. I have a method in application.rb that sets up my layout, and does this everytime the page loads. However, it was suggested to me that I write a cron job to pull in flickr data and cache it to a file in my rails app every 30 minutes or so, then use that file to display my images. How can I do this? I''ve never written a cron job, and I don''t really know how the process works. Can I basically just put the ruby code that gathers the images into a file, and execute that file every 30 minutes via the cron job? If so, what''s the recommended way to handle the processing to get the images to appear on my site? I was directed to this: http://drupal.org/node/31548 But that''s only a small piece of the puzzle for me. Thanks for any help. -- 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 -~----------~----~----~----~------~----~------~--~---
On 2/8/07, rph <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I''m currently using net/http to get my flickr data and displaying it on > my site. I have a method in application.rb that sets up my layout, and > does this everytime the page loads. > > However, it was suggested to me that I write a cron job to pull in > flickr data and cache it to a file in my rails app every 30 minutes or > so, then use that file to display my images. How can I do this? > > I''ve never written a cron job, and I don''t really know how the process > works. Can I basically just put the ruby code that gathers the images > into a file, and execute that file every 30 minutes via the cron job? > If so, what''s the recommended way to handle the processing to get the > images to appear on my site? > > I was directed to this: http://drupal.org/node/31548 > > But that''s only a small piece of the puzzle for me. Thanks for any > help. >You need to do two things which are separate cycles. The first is to write a script (in ruby or any language) to grab the flickr data. Once this script works from the command line you can instruct cron to execute the script at certain intervals. To learn about cron, use google or man cron or man crontab. Hope this helps. -- Zack Chandler http://depixelate.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 -~----------~----~----~----~------~----~------~--~---
> > You need to do two things which are separate cycles. The first is to > write a script (in ruby or any language) to grab the flickr data. > Once this script works from the command line you can instruct cron to > execute the script at certain intervals. > > To learn about cron, use google or man cron or man crontab. > > Hope this helps. > > -- > Zack Chandler > http://depixelate.comOk, thanks. One more thing, is there a place to store the cron job? Or do you just execute it via command line and then it is always there? -- 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 -~----------~----~----~----~------~----~------~--~---
On 2/8/07, rph <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > > > > You need to do two things which are separate cycles. The first is to > > write a script (in ruby or any language) to grab the flickr data. > > Once this script works from the command line you can instruct cron to > > execute the script at certain intervals. > > > > To learn about cron, use google or man cron or man crontab. > > > > Hope this helps. > > > > -- > > Zack Chandler > > http://depixelate.com > > Ok, thanks. One more thing, is there a place to store the cron job? Or > do you just execute it via command line and then it is always there?You add a line to a special file called crontab. This line specifies how often a job should be run. Run a man crontab to check out the format or use google. -- Zack Chandler http://depixelate.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 -~----------~----~----~----~------~----~------~--~---