Help writing a cron job to get Flickr photos

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: Configuring cron jobs with DreamHost | Setting up cron | Drupal Wiki guide on Drupal.org

But that’s only a small piece of the puzzle for me. Thanks for any
help.

On 2/8/07, rph [email protected] wrote:

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: Configuring cron jobs with DreamHost | Setting up cron | Drupal Wiki guide on Drupal.org

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 C.
http://depixelate.com

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 C.
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?

On 2/8/07, rph [email protected] wrote:

Hope this helps.


Zack C.
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 C.
http://depixelate.com