Master ruby with us

Do we really need BackgrounDRb now ? Craken plugin makes job easier in Ruby on Rails

Posted by firstruby on January 1, 2010

There was some issue with BackgrounDRb like Memory leakage, so it was braeking the cron jobs. There are alternatives to BackgrounDRb as Craken. Craken is best.

Craken is a Ruby on Rails plugin for managing and installing rake-centric crontab.

Craken Installation as,

./script/plugin install git://

Craken Configuration with Ruby on Rails app,
You need to write the RAKE task which needs to run after some intervals.
Suppose I have a RAKE task db:send_emails

Create Crontab file at following path,


Add configuration to raketab.yml as,

hour: 0
minute: *
day: *
month: *
command: db:send_emails > /tmp/db_send_emails.log 2>&1

Above configuration will run the “db:send_emails” tasks after very 24 hours (midnight)

Finally create the CRON job with following command,

rake craken:install

Above command will create a cronjob.

For Production mode,
rake craken:install RAILS_ENV=production

You are done 🙂

More about it……..,
If we need to check the Cronjob, you can give the following command,

crontab -l

Following command displays the log once CRON job executes
tail -f /var/log/syslog

Ref URL –


2 Responses to “Do we really need BackgrounDRb now ? Craken plugin makes job easier in Ruby on Rails”

  1. Arun Verma said

    I tried to apply this craken plugin, as instructed above but I am geting error.. below is the detail what I have done

    I installed the plugin and it was successfully installed

    I created a rake task named db_delete_posts.log under temp directory as below

    namespace :db do
    desc ‘Delete old posts that are over 5 minutes old’
    task :delete_posts => :environment do
    puts “posts have been deleted!”

    then I created the raketab.yml file as below

    ## YAML Template.
    hour: 0
    minute: *
    day: *
    month: *
    command: rake db:delete_posts > /tmp/db_delete_posts.log 2>&1

    After all these when I am running the command “rake craken:install” (in development environment on local server)

    I am getting the following error

    craken:install => Using raketab file /home/arun/rails_apps/backgroundjobs/config/craken/raketab.yml
    rake aborted!
    undefined method `[]’ for nil:NilClass

    (See full trace by running task with –trace)

    I did not understand the reason. Did I miss something ?

    • firstruby said

      In raketab.yml file, you need to remove “RAKE” word from following line,

      command: rake db:delete_posts > /tmp/db_delete_posts.log 2>&1

      It should look like,

      command: db:delete_posts > /tmp/db_delete_posts.log 2>&1

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: