Forking a Daemon Process on Unix.rb
require 'tempfile'
require 'daemonize'
include Daemonize
daemonize # Now you're a daemon process!
log = Tempfile.new('daemon.log')
loop do
log.puts "I'm a daemon, doin' daemon things."
log.flush
sleep 5
end
Related examples in the same category