Scheduled processes


#1

How in Rails do you set up a scheduled process, i.e. something that for
example periodically sends out an email to the site’s users. Is this
possible?


#2

On 30 Nov 2005, at 21:47, Frank K. wrote:

How in Rails do you set up a scheduled process, i.e. something that
for example periodically sends out an email to the site’s users.
Is this possible?

I’d do this by having a scheduled job visit your mail controller and
call a send_email action at a regular interval. Make sure you
authenticate the job – check IP addresses etc – so that people
can’t cause your app to send email by visiting the wrong URI.

Yours,
Craig

Craig W. | t: +44 (0)131 516 8595 | e: removed_email_address@domain.invalid
Xeriom.NET | f: +44 (0)709 287 1902 | w: http://xeriom.net


#3

Hi Craig,
I am guessing you mean that the scheduled job is created outside of
rails,
whether it be a wget in a cron job or something like that, instead of
within
rails, right?
-Frank


#4

Thanks. Based on that page it looks like the best answer for now is to
use
cron with wget, not the most satisfying answer.


#5

Frank,

Take a look at this page on the wiki:
http://wiki.rubyonrails.com/rails/pages/HowToRunBackgroundJobsInRails

Cody

On 11/30/05, Frank K. removed_email_address@domain.invalid wrote:

How in Rails do you set up a scheduled process, i.e. something that


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


http://www.codyfauser.com


#6

on an app I had to do something along these lines i created a cron dir
off the project root, and just created a .rb script and added it to my
cron… add the following to the top to work within your environment/app:

#!/usr/bin/ruby
ENV[‘RAILS_ENV’] = ‘production’
require File.dirname(FILE) + ‘/…/config/environment’


#7

Frank,

You can’t use script/runner with cron? Its usage should be described
on that same page.

Cody

On 11/30/05, Jerrett T. removed_email_address@domain.invalid wrote:

Hi Craig,

for example periodically sends out an email to the site’s users.
Craig W. | t: +44 (0)131 516 8595 | e: removed_email_address@domain.invalid

http://www.codyfauser.com


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


http://www.codyfauser.com