[Backgroundrb-devel] stability of using scheduled workers
Charles Brian Quinn
me at seebq.com
Thu Aug 16 13:03:43 EDT 2007
Use the full path to ruby:
/usr/local/bin/ruby /var/www/rails/434Wireless/script/runner "Ping.test_cron"
On 8/16/07, Simon <simon.wilkinson at 434wireless.com> wrote:
> Hi,
>
> 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")
> end
>
> 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
> happening?
>
> Thanks,
>
> Simon
>
> -----Original Message-----
> From: benr75 at gmail.com [mailto:benr75 at gmail.com] On Behalf Of Ben
> Reubenstein
> 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,
>
> Ben
>
> 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
> 303-947-0446
> http://www.benr75.com
>
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>
--
Charles Brian Quinn
self-promotion: www.seebq.com
highgroove studios: www.highgroove.com
slingshot rails business hosting: www.slingshothosting.com
main: 404.394.4935 fax: 678.826.0969
Ruby on Rails Bootcamp at the Big Nerd Ranch
Intensive Ruby on Rails Training:
http://www.bignerdranch.com/classes/ruby.shtml
More information about the Backgroundrb-devel
mailing list