Never been to DZone Snippets before? Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world The following code lets you implement a daemon very easily, and also lets you write cleanup code. Update: I made some small changes to make it look slightly better. 1 2 require 'fileutils'