forever - daemon μ-framework in Ruby

Apparently, ‘forever’ is a great name for a project that daemonizes things. This isn’t the forever that we covered two weeks ago, but it is similar. EDIT: Davide has changed the name to ‘foreverb’, to distinguish the two.

With Davide D’Agostino’s project, you can make any little bit of Ruby code into a daemon quickly and easily. I’d used the skinny daemons technique in the past, but this is even easier! Let’s say I have a module named Foo, and it has a method long_running_process. I could daemonize this with a simple

#!/usr/bin/env ruby
require 'rubygems'
require 'forever'

Forever.run do
  on_ready do
    Foo.long_running_process
  end
end

It’s just that easy! You can check out the README for more details, including monitoring your daemons and handling errors.

View the project on GitHub and discuss on Hacker News.

News Films

Our little film studio focuses on telling developer-centric stories that need to be seen.

Beyond Code: Season 3 / GopherCon 2015

 
0:00 / 0:00