Skip to content
Open
5 changes: 5 additions & 0 deletions bin/god
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ begin
options[:port] = x
end


opts.on("-b", "--auto-bind", "Auto-bind to an unused port number") do
options[:port] = "0"
end
Expand All @@ -60,6 +61,10 @@ begin
options[:pid] = x
end

opts.on("--managed-pid-dir DIR", "Where to write the PIDs for the workers") do |x|
options[:managed_pid_dir] = x
end

opts.on("-lFILE", "--log FILE", "Where to write the log file") do |x|
options[:log] = x
end
Expand Down
5 changes: 4 additions & 1 deletion lib/god/cli/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def default_run
God.port = @options[:port]
end

if @options[:managed_pid_dir]
God.pid_file_directory = @options[:managed_pid_dir]
end

if @options[:events]
God::EventHandler.load
end
Expand Down Expand Up @@ -118,7 +122,6 @@ def run_daemonized
if @options[:pid]
File.open(@options[:pid], 'w') { |f| f.write pid }
end

::Process.detach pid

exit
Expand Down