Posts Tagged ‘backgroundrb’

Debugging Backgroundrb

Monday, February 11th, 2008

Backgroundrb is a great tool for getting cron like functionality in your Rails app, but it can be a pain if its not working correctly. I’m not going to go into how to get backgroundrb working, its rubyforge page has decent instructions for that, but what I will share are some tips on debugging a non-working worker.

Obviously check your RAILS_ROOT/log and check backgroundrb.log, backgroundrb_server.log, and backgroundrb_debug.log. I’ve found backgroundrb.log most useful, but many times I’ll restart backgroundrb by

script/backgroundrb stop

script/backgroundrb start #restart doesn’t work for me

and nothing will happen. Check your backgroundrb_server.log file and you may see that the ‘address is already in use”.

Type “top” into your command line (on a Linux system) and then press shift+M. You should get a nice list of services running and you’ll more than likely have a couple of rubys on there. For some reason backgroundrb doesn’t stop all the time when you tell it to and I’ve had to kill -9 the rubys and then restart backgroundrb and mongrel.

You may also notice that the backgroundrb ruby instance uses ALOT of memory! Make sure you have

:environment: production

in your backgroundrb.yml file in RAILS_ROOT/config. Otherwise backgroundrb is working in development mode.

Finally, to debug an syntax or other error try this.

1. open 2 command lines.

2. start your rails app with ruby script/server. Make sure to start it in development mode and not using mongrel_rails.

3. start backgroundrb in the other terminal.

4. watch the first terminal and you can see what background rb is doing and where exactly it gets messed up.

You can do this by monitoring the log file or tailing it, but I like this better and it provides you with more info.

Hope this helps any of you out.

Royner – New Project

Thursday, January 24th, 2008

I’m happy to say that I’m almost done with my newest project – Royner. It doesn’t live anywhere yet, just on my local machine, but heres what it is:

Really simple – you give Royner a feed (Atom, RSS, XML) and Royner monitors that feed for some keywords that you define. So, lets say you want to monitor the Slickdeals.net RSS feed of deals for “FAR” (Free after rebate). When something is posted that is free after rebate, Royner will send you an IM letting you know of the deal and the url. You could use it for whatever you want. Monitor blogs, Digg, hell, even your email.

Currently, only Jabber/GTalk is supported since it is the easiest to integrate.

Pretty neat eh?
Heres some screenies. Hopefully it will be ready for the public in a week or so.
royner1royner2royner3

The one thing I’ll say is this though – I used backgroundrb to monitor the feeds. Now, once I got it running ok, it worked wonderfully, but I swear it was the most difficult Rails plugin to get working. I spent an ENTIRE day trying to get it to work. In the end, I uninstalled and reinstalled the plugin and that did it. The first time I installed, for some reason an old version was installed and none of the documentation worked. Blah.