diff --git a/script/websocket-server.rb b/script/websocket-server.rb index 85ba09b2f..6e0ce8631 100644 --- a/script/websocket-server.rb +++ b/script/websocket-server.rb @@ -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 {