Added pid support.

This commit is contained in:
Martin Edenhofer 2013-01-15 23:33:51 +01:00
parent 8638a41b58
commit ac744d3cd5

View file

@ -15,6 +15,7 @@ require 'optparse'
:d => false,
:k => '/path/to/server.key',
:c => '/path/to/server.crt',
:i => Dir.pwd.to_s + '/tmp/pids/websocket.pid'
}
tls_options = {}
OptionParser.new do |opts|
@ -43,6 +44,12 @@ end.parse!
puts "Starting websocket server on #{ @options[:b] }:#{ @options[:p] } (secure:#{ @options[:s].to_s })"
#puts options.inspect
# create pid file
$daemon_pid = File.new( @options[:i],"w" )
$daemon_pid.sync = true
$daemon_pid.puts(Process.pid.to_s)
$daemon_pid.close
@clients = {}
@spool = []
EventMachine.run {