Suggestions on automation?

Hi all,

In continuing with my port from Java to Rails I wanted to ask what
people are using for automated tasks. In our current app we have a
standalone server that pulls RSS feeds everyday and converts them to
the appropriate content types on our system and then another task
fires which goes thru these content types and generates an automated
email message notifying users of any matches for the day.

Currently we’re using Spring and Hibernate with Spring’s Quartz timer
functionality. I could easily move the firing of the processes
themselves to the appropriate cron jobs (which I’ll prob do), but I’d
still like to use AR and whatever else of Rails is necessary to read/
write from the db. Does anyone have a preferred way of doing this so
that I can call a Ruby file and have it use all my existing code and
support from Rails?

Thanks,

  • jason

On Saturday 26 November 2005 17:44, Jason L. wrote:

functionality. I could easily move the firing of the processes
themselves to the appropriate cron jobs (which I’ll prob do), but I’d
still like to use AR and whatever else of Rails is necessary to read/
write from the db. Does anyone have a preferred way of doing this so
that I can call a Ruby file and have it use all my existing code and
support from Rails?

Why not write a little Ruby daemon which uses ActiveRecord? You
can use AR outside of Rails. If you don’t like that idea you could
put the work into a action which you ‘call’ by requesting it
when you want the tasks to be performed. You just need to make
your models available to the daemon script.

I have lots of little Ruby daemons which use AR for all sorts
of things.

Thanks,

  • jason

Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

HTH,

http://wiki.rubyonrails.org/rails/pages/HowToRunBackgroundJobsInRails/versions/1

Hi,

yes, I saw this. However, I’m not really looking to run jobs in the
background or to fork functionality during a webapp. I’m actually
looking to run jobs on a separate machine (altho, the machine is not
really the issue) and to actually include my Rails code into the task
I’m doing. So like cron -> MyTask.rb -> use existing AR objects.
Thanks tho, I’ll keep looking.

-jason

Yes, if you really the page closely, it describes just that (plus some
more)
(hint: script/runner)

This may answers your question:

http://wiki.rubyonrails.org/rails/pages/HowToRunBackgroundJobsInRails

Ok, I’ll re-read it again, but more carefully this time. :wink: thx.