1require 'drb/drb'
2require 'rinda/ring'
3require 'rinda/tuplespace'
4
5unless $DEBUG
6  # Run as a daemon...
7  exit!( 0 ) if fork
8  Process.setsid
9  exit!( 0 ) if fork
10end
11
12DRb.start_service(ARGV.shift)
13
14ts = Rinda::TupleSpace.new
15place = Rinda::RingServer.new(ts)
16
17if $DEBUG
18  puts DRb.uri
19  DRb.thread.join
20else
21  STDIN.reopen('/dev/null')
22  STDOUT.reopen('/dev/null', 'w')
23  STDERR.reopen('/dev/null', 'w')
24  DRb.thread.join
25end
26