From ac744d3cd5ff13e97343ad66ff5ef491730d7335 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 15 Jan 2013 23:33:51 +0100 Subject: [PATCH] Added pid support. --- script/websocket-server.rb | 7 +++++++ 1 file changed, 7 insertions(+) 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 {