Skip to content

Instantly share code, notes, and snippets.

@tomekr
Created June 21, 2012 23:05
Show Gist options
  • Save tomekr/2969149 to your computer and use it in GitHub Desktop.
Save tomekr/2969149 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems' # if you use RubyGems
require 'daemons'
task1 = Daemons.call(:multiple => true) do
loop {
File.open("/tmp/daemon_test.log", "w") {|f| f.write(Time.now.to_s + "\n")}
sleep 5
}
end
puts task1.pid.pid
puts task1.pid
#ruby test.rb
#nil
##<Daemons::PidMem:0x10a3d6818>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment