[Backgroundrb-devel] stability of using scheduled workers

Simon simon.wilkinson at 434wireless.com
Thu Aug 16 12:32:10 EDT 2007


I have tried this, and can't seem to get it going.  Is there anything
special that needs to be done to the script?

I also tried to just set up a test through one of the models, where it would
just print the current time to a file, just to see if that would work.  It
also didn't work.

Here is the line I had in my crontab:
* * * * * ruby /var/www/rails/434Wireless/script/runner "Ping.test_cron"

And here is the function in my Ping model:
  def self.test_cron
    test = Time.now.to_s(:db)
    system("echo #{test} >> /var/log/test.log")

So I just want the current time added to a file, and for it to trigger every
minute (useless I know, but I'm just testing things here :) ).  When I just
run 'ruby /var/www/rails/434Wireless/script/runner "Ping.test_cron"' from
the command line, everything works perfectly.  Any ideas on what is



-----Original Message-----
From: benr75 at gmail.com [mailto:benr75 at gmail.com] On Behalf Of Ben
Sent: 03 August 2007 12:29
To: simon.wilkinson at 434wireless.com
Cc: backgroundrb-devel at rubyforge.org
Subject: Re: [Backgroundrb-devel] stability of using scheduled workers

Hello ~

I have found that a much better way to do scheduled tasks is to use
script/runner with crontab or cron.  You then get access to your
entire rails environment very easily.  So for example in crontab I
have a task that runs every half-hour:

0,30 * * * * ruby /path/to/script/runner 'load "/path/to/your/script/my.rb"'

I do however use backgroundrb for user initiated tasks such as
processing a file and sending updates to the browser.  I have found
this to be extremely reliable.

Hope this helps,


On 8/1/07, simon.wilkinson at 434wireless.com
<simon.wilkinson at 434wireless.com> wrote:
> Hi,
> Going through the archive, and just keeping a general watch on this list
seems to indicate that there are some issues using scheduling with
backgroundrb.  I need a worker that will perform some actions on an hourly
interval.  These actions will require access to several of the models in my
application.  I am currently using backgroundrb to handle processing of
files, where I spawn a worker to handle each file, and then destroy them
afterwards.  This is working great, and I would like to use backgroundrb for
this scheduled action, but I need it to be reliable.
> What is the general feeling among those that are using it for this type of
application?  Does it reliably continue to fire at the proper intervals?
> Thanks,
> Simon
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel

Ben Reubenstein

More information about the Backgroundrb-devel mailing list