Sha256: 4835bf92337b881143f94e4c0dfa3550ee8161ade956a641e7559bb4940147b3

Contents?: true

Size: 580 Bytes

Versions: 5

Compression:

Stored size: 580 Bytes

Contents

lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib'))

if File.exist?(File.join(lib_dir, 'daemons.rb'))
  $LOAD_PATH.unshift lib_dir
else
  begin; require 'rubygems'; rescue ::Exception; end
end


require 'daemons'


Daemons.run_proc('myscript') do
  loop do
    file = File.open('/tmp/myscript.log', 'a')
    file.write(Random.rand)   # breaks without seeding
    # file.write(Random.new.rand)  # works without seeding
    # file.write(rand) # also works, but this is Kernel.rand() so its different
    file.write("\n")
    file.close()
    sleep 2
  end
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_proc_rand.rb
blue-daemons-1.1.11 examples/run/ctrl_proc_rand.rb
mlanett-daemons-1.1.10.3 examples/run/ctrl_proc_rand.rb
mlanett-daemons-1.1.10.2 examples/run/ctrl_proc_rand.rb
daemons-1.1.9 examples/run/ctrl_proc_rand.rb