The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Daemonize

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Red Handed

Posts: 1158
Nickname: redhanded
Registered: Dec, 2004

Red Handed is a Ruby-focused group blog.
Daemonize Posted: Feb 2, 2005 10:52 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Red Handed.
Original Post: Daemonize
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Red Handed
Latest Posts From RedHanded

Advertisement

Here’s one from an RAA dig a few weeks ago. Wanting to turn some of my Ruby jobs into daemons, I went looking for anything slightly formal. And Daemonize is 59 lines of Ruby that fits just right.

 require 'daemonize'
 include Daemonize

 daemonize()
 loop do
   # Your code cycles here
 end

Daemonize will safely fork, retrying if the maximum process limit has been reached. It detaches from the controlling terminal, resets the cwd and umask, then closes all file descriptors. And so my little scripts buzz around noiselessly.

Read: Daemonize

Topic: ruby2c mailing list Previous Topic   Next Topic Topic: Syndication and TaDa

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use