Skip to content
This repository has been archived by the owner on Jul 23, 2023. It is now read-only.

Add --pid_file command line option #95

Merged
merged 1 commit into from Jul 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -141,6 +141,8 @@ Slanger supports several configuration options, which can be supplied as command
-c or --cert_chain_file Certificate chain file or the Certificate file for SSL support. This argument is optional, if given, SSL will be enabled

-v or --[no-]verbose This makes Slanger run verbosely, meaning WebSocket frames will be echoed to STDOUT. Useful for debugging

--pid_file The path to a file you want slanger to write it's PID to. Optional.
</pre>


Expand Down
10 changes: 10 additions & 0 deletions bin/slanger
Expand Up @@ -59,6 +59,10 @@ OptionParser.new do |opts|
options[:debug] = v
end

opts.on '--pid_file PIDFILE', "The slanger process ID file name." do |k|
options[:pid_file] = k
end

opts.parse!

%w<app_key secret>.each do |parameter|
Expand Down Expand Up @@ -86,6 +90,12 @@ EM.kqueue
EM.run do
File.tap { |f| require f.expand_path(f.join(f.dirname(__FILE__),'..', 'slanger.rb')) }
Slanger::Config.load options

# Write PID to file
unless options[:pid_file].nil?
File.open(options[:pid_file], 'w') { |f| f.puts Process.pid }
end

Slanger::Service.run

puts "\n"
Expand Down