From 415373799c94d104c246100a10d20eb6428823c0 Mon Sep 17 00:00:00 2001 From: Brian Lauber Date: Wed, 7 May 2014 13:58:55 -0400 Subject: [PATCH 1/9] PID dir can be specified for worker processes --- bin/god | 5 +++++ god.gemspec | 2 +- lib/god.rb | 2 +- lib/god/cli/run.rb | 4 ++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/god b/bin/god index 149df077..64306df8 100755 --- a/bin/god +++ b/bin/god @@ -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 @@ -60,6 +61,10 @@ begin options[:pid] = x end + opts.on("-MDIR", "--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 diff --git a/god.gemspec b/god.gemspec index dd71c23b..8a15074c 100644 --- a/god.gemspec +++ b/god.gemspec @@ -3,7 +3,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.name = 'god' - s.version = '0.13.4' + s.version = '0.13.4.1' s.date = '2014-03-05' s.summary = "Process monitoring framework." diff --git a/lib/god.rb b/lib/god.rb index 9b3c72bd..7a0ab010 100644 --- a/lib/god.rb +++ b/lib/god.rb @@ -159,7 +159,7 @@ def safe_attr_accessor(*args) module God # The String version number for this package. - VERSION = '0.13.4' + VERSION = '0.13.4.1' # The Integer number of lines of backlog to keep for the logger. LOG_BUFFER_SIZE_DEFAULT = 100 diff --git a/lib/god/cli/run.rb b/lib/god/cli/run.rb index 628cc26a..ceb86456 100644 --- a/lib/god/cli/run.rb +++ b/lib/god/cli/run.rb @@ -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 From 22228d460e19ab99f3fe3c93b638291e264319f9 Mon Sep 17 00:00:00 2001 From: Brian Lauber Date: Thu, 8 May 2014 22:59:18 -0400 Subject: [PATCH 2/9] Updated command-line options for managed pids dir --- bin/god | 2 +- god.gemspec | 2 +- lib/god.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/god b/bin/god index 64306df8..f6a55166 100755 --- a/bin/god +++ b/bin/god @@ -61,7 +61,7 @@ begin options[:pid] = x end - opts.on("-MDIR", "--managed_pid_dir DIR", "Where to write the PIDs for the workers") do |x| + opts.on("--managed-pid-dir DIR", "Where to write the PIDs for the workers") do |x| options[:managed_pid_dir] = x end diff --git a/god.gemspec b/god.gemspec index 8a15074c..d57b100e 100644 --- a/god.gemspec +++ b/god.gemspec @@ -3,7 +3,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.name = 'god' - s.version = '0.13.4.1' + s.version = '0.13.4.2' s.date = '2014-03-05' s.summary = "Process monitoring framework." diff --git a/lib/god.rb b/lib/god.rb index 7a0ab010..8f4ac9a1 100644 --- a/lib/god.rb +++ b/lib/god.rb @@ -159,7 +159,7 @@ def safe_attr_accessor(*args) module God # The String version number for this package. - VERSION = '0.13.4.1' + VERSION = '0.13.4.2' # The Integer number of lines of backlog to keep for the logger. LOG_BUFFER_SIZE_DEFAULT = 100 From 13d98eb0fd43ee984543ebb859efbeb37b1054e0 Mon Sep 17 00:00:00 2001 From: Scott Dubinsky Date: Thu, 4 Sep 2014 16:41:28 -0400 Subject: [PATCH 3/9] Stops failing silently when the godfile is wrong. --- lib/god/cli/run.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/god/cli/run.rb b/lib/god/cli/run.rb index ceb86456..ce5b2ba3 100644 --- a/lib/god/cli/run.rb +++ b/lib/god/cli/run.rb @@ -122,7 +122,12 @@ def run_daemonized if @options[:pid] File.open(@options[:pid], 'w') { |f| f.write pid } end - + #sleep a few second to make sure that the godfile has a chance to be read + sleep(3) + #returns nil if the process hasn't ended yet + if Process.waitpid(pid, Process::WNOHANG) + puts "Likely an error with the .god file. In any event, the god process has already exited." + end ::Process.detach pid exit From d75ead147b00bdd59684c5831f8299927766f03b Mon Sep 17 00:00:00 2001 From: Scott Dubinsky Date: Thu, 4 Sep 2014 16:50:20 -0400 Subject: [PATCH 4/9] Updates version number. --- god.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/god.gemspec b/god.gemspec index d57b100e..1fe9468d 100644 --- a/god.gemspec +++ b/god.gemspec @@ -3,7 +3,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.name = 'god' - s.version = '0.13.4.2' + s.version = '0.13.4.3' s.date = '2014-03-05' s.summary = "Process monitoring framework." From f48d0292f92146b0647035e13d4fdbe7f5f26c87 Mon Sep 17 00:00:00 2001 From: Scott Dubinsky Date: Thu, 4 Sep 2014 17:17:44 -0400 Subject: [PATCH 5/9] Updates timing. --- lib/god/cli/run.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/god/cli/run.rb b/lib/god/cli/run.rb index ce5b2ba3..3bccbb7a 100644 --- a/lib/god/cli/run.rb +++ b/lib/god/cli/run.rb @@ -123,10 +123,10 @@ def run_daemonized File.open(@options[:pid], 'w') { |f| f.write pid } end #sleep a few second to make sure that the godfile has a chance to be read - sleep(3) + sleep 3 #returns nil if the process hasn't ended yet if Process.waitpid(pid, Process::WNOHANG) - puts "Likely an error with the .god file. In any event, the god process has already exited." + puts "There is likely an error with the .god file. In any event, the god process has already exited." end ::Process.detach pid From 4137b913f54d64be22321effd31133e876b4553f Mon Sep 17 00:00:00 2001 From: Brian Lauber Date: Fri, 5 Sep 2014 11:48:58 -0400 Subject: [PATCH 6/9] God exits w/ status 1 when daemon fails to launch --- lib/god/cli/run.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/god/cli/run.rb b/lib/god/cli/run.rb index 3bccbb7a..700149ce 100644 --- a/lib/god/cli/run.rb +++ b/lib/god/cli/run.rb @@ -123,10 +123,13 @@ def run_daemonized File.open(@options[:pid], 'w') { |f| f.write pid } end #sleep a few second to make sure that the godfile has a chance to be read + puts "Waiting 3 seconds to verify that the daemon launched..." sleep 3 + #returns nil if the process hasn't ended yet - if Process.waitpid(pid, Process::WNOHANG) + if ::Process.waitpid(pid, Process::WNOHANG) puts "There is likely an error with the .god file. In any event, the god process has already exited." + exit 1 end ::Process.detach pid From 3302101cd018fe1f6b62246f58779009f637792c Mon Sep 17 00:00:00 2001 From: Brian Lauber Date: Fri, 5 Sep 2014 11:49:26 -0400 Subject: [PATCH 7/9] Fixed another version string in the code --- lib/god.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/god.rb b/lib/god.rb index b3ce027e..839d612d 100644 --- a/lib/god.rb +++ b/lib/god.rb @@ -160,7 +160,7 @@ def safe_attr_accessor(*args) module God # The String version number for this package. - VERSION = '0.13.4.2' + VERSION = '0.13.4.3' # The Integer number of lines of backlog to keep for the logger. LOG_BUFFER_SIZE_DEFAULT = 100 From 0da57729c60a7b7e4ef9ca89fab59aa3c6c261eb Mon Sep 17 00:00:00 2001 From: Brian Lauber Date: Fri, 30 Jan 2015 01:05:59 -0500 Subject: [PATCH 8/9] Removed daemon launch verification logic --- lib/god/cli/run.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/god/cli/run.rb b/lib/god/cli/run.rb index 700149ce..ceb86456 100644 --- a/lib/god/cli/run.rb +++ b/lib/god/cli/run.rb @@ -122,15 +122,7 @@ def run_daemonized if @options[:pid] File.open(@options[:pid], 'w') { |f| f.write pid } end - #sleep a few second to make sure that the godfile has a chance to be read - puts "Waiting 3 seconds to verify that the daemon launched..." - sleep 3 - - #returns nil if the process hasn't ended yet - if ::Process.waitpid(pid, Process::WNOHANG) - puts "There is likely an error with the .god file. In any event, the god process has already exited." - exit 1 - end + ::Process.detach pid exit From f9f79c9945ccd5cf7bbfb3425686aaeabf7c6522 Mon Sep 17 00:00:00 2001 From: Brian Lauber Date: Fri, 30 Jan 2015 01:20:09 -0500 Subject: [PATCH 9/9] Removed a newline character to force a travis-ci rebuild --- lib/god/cli/run.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/god/cli/run.rb b/lib/god/cli/run.rb index ceb86456..6ab5ab29 100644 --- a/lib/god/cli/run.rb +++ b/lib/god/cli/run.rb @@ -122,7 +122,6 @@ def run_daemonized if @options[:pid] File.open(@options[:pid], 'w') { |f| f.write pid } end - ::Process.detach pid exit