unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: "Iñaki Baz Castillo" <ibc@aliax.net>
To: mongrel-unicorn@rubyforge.org
Subject: Re: Suggestion for reload action (USR2)
Date: Wed, 20 Jan 2010 10:20:23 +0100	[thread overview]
Message-ID: <201001201020.23413.ibc@aliax.net> (raw)

El Miércoles, 20 de Enero de 2010, Iñaki Baz Castillo escribió:

> This would involve just three changes:
> 
> - Add an option "--reload" in OptionParser in bin/unicorn.
> - Store such option somewhere so it can be readed later by the Rack
> application or other library.
> - Add "--reload" to the list of original arguments when receiving USR2.

I attach a patch (for master branch) that would do the job (except the 
fact that I don't know how to store the "reload" option):


-----------------------------------------
diff --git a/bin/unicorn b/bin/unicorn
index 5af021d..43f5434 100755
--- a/bin/unicorn
+++ b/bin/unicorn
@@ -88,6 +88,10 @@ opts = OptionParser.new("", 24, '  ') do |opts|
     options[:config_file] = f
   end

+  opts.on("--reload", "HIDDEN") do |f|
+    # TODO: Store it somewhere
+  end
+
   # I'm avoiding Unicorn-specific config options on the command-line.
   # IMNSHO, config options on the command-line are redundant given
   # config files and make things unnecessarily complicated with multiple
@@ -96,7 +100,7 @@ opts = OptionParser.new("", 24, '  ') do |opts|
   opts.separator "Common options:"

   opts.on_tail("-h", "--help", "Show this message") do
-    puts opts.to_s.gsub(/^.*DEPRECATED.*$/s, '')
+    puts opts.to_s.gsub(/^.*DEPRECATED.*$/s, '').gsub(/^.*HIDDEN.*$/s, '')
     exit
   end

diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index e3e4315..49ad79b 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -519,7 +519,7 @@ module Unicorn
         end
         logger.info "executing #{cmd.inspect} (in #{Dir.pwd})"
         before_exec.call(self)
-        exec(*cmd)
+        exec(*cmd << "--reload")
       end
       proc_name 'master (old)'
     end
-----------------------------------------


The patch is available here:
  http://oversip.net/public/unicorn_reload.patch

(unfortunatelly I cannot attach files in this mailist as the mail is 
rejected).


Regards.


-- 
Iñaki Baz Castillo <ibc@aliax.net>
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

             reply	other threads:[~2010-01-20  9:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-20  9:20 Iñaki Baz Castillo [this message]
2010-01-20 20:03 ` Suggestion for reload action (USR2) Eric Wong
2010-01-20 20:22   ` Iñaki Baz Castillo
2010-01-20 20:58     ` Eric Wong
2010-01-21 11:20       ` Iñaki Baz Castillo
  -- strict thread matches above, loose matches on Subject: below --
2010-01-20  8:54 Iñaki Baz Castillo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201001201020.23413.ibc@aliax.net \
    --to=ibc@aliax.net \
    --cc=mongrel-unicorn@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).