* [PATCH] Show the current working directory in the proc title
@ 2010-07-02 20:50 Jeremy Evans
2010-07-02 22:29 ` Eric Wong
0 siblings, 1 reply; 5+ messages in thread
From: Jeremy Evans @ 2010-07-02 20:50 UTC (permalink / raw)
To: mongrel-unicorn
>From 7aec3c7f83430900e91f7df854577f1bac5e7c3a Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@jeremyevans.net>
Date: Fri, 2 Jul 2010 13:46:15 -0700
Subject: [PATCH] Show the current working directory in the proc title
This is helpful if you run a server with many web apps in separate
directories all running unicorn, as it allows you to easily see
which processes are tied to which app.
---
lib/unicorn.rb | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index a7b0646..a764cd7 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -811,8 +811,8 @@ module Unicorn
end
def proc_name(tag)
- $0 = ([ File.basename(START_CTX[0]), tag
- ]).concat(START_CTX[:argv]).join(' ')
+ $0 = ([ File.basename(START_CTX[0]), File.basename(START_CTX[:cwd]),
+ tag ]).concat(START_CTX[:argv]).join(' ')
end
def redirect_io(io, path)
--
1.7.0.5
_______________________________________________
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Show the current working directory in the proc title
2010-07-02 20:50 [PATCH] Show the current working directory in the proc title Jeremy Evans
@ 2010-07-02 22:29 ` Eric Wong
2010-07-02 22:50 ` Jeremy Evans
0 siblings, 1 reply; 5+ messages in thread
From: Eric Wong @ 2010-07-02 22:29 UTC (permalink / raw)
To: unicorn list
Jeremy Evans <code@jeremyevans.net> wrote:
> This is helpful if you run a server with many web apps in separate
> directories all running unicorn, as it allows you to easily see
> which processes are tied to which app.
Hi Jeremy,
I recommend using absolute paths with -c/--config-file and allowing
users to opt-in to it (everybody should be using a Unicorn config
file in production).
Having an extra working directory path in there hurts people on smaller
terminals[1]. With -c, users have more control of what their
command-line looks like without having something forced on them.
I can't see myself accepting this patch right now for the above reasons.
On the other hand, I don't see any reason to alter the way proc_name is
used in the future, so monkey patching here is fine.
I'm sure there'll always be folks that will want something different in
$0 (as evidenced by Rack::Contrib::ProcTitle and like).
[1] - I try to be considerate of on-call folks working from mobile
phones or netbooks and/or bad net connections. There's even
a test in test_exec.rb to ensure the help output text can fit
in standard 80x24 ANSI terminals. Personally, I refuse to use
a terminals wider than 80 columns (actually, I would've
preferred the world standardized on a 64-column wrap)
--
Eric Wong
_______________________________________________
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Show the current working directory in the proc title
2010-07-02 22:29 ` Eric Wong
@ 2010-07-02 22:50 ` Jeremy Evans
2010-07-05 23:34 ` Eric Wong
0 siblings, 1 reply; 5+ messages in thread
From: Jeremy Evans @ 2010-07-02 22:50 UTC (permalink / raw)
To: unicorn list
On Fri, Jul 2, 2010 at 3:29 PM, Eric Wong <normalperson@yhbt.net> wrote:
> Jeremy Evans <code@jeremyevans.net> wrote:
>> This is helpful if you run a server with many web apps in separate
>> directories all running unicorn, as it allows you to easily see
>> which processes are tied to which app.
>
> Hi Jeremy,
>
> I recommend using absolute paths with -c/--config-file and allowing
> users to opt-in to it (everybody should be using a Unicorn config
> file in production).
>
> Having an extra working directory path in there hurts people on smaller
> terminals[1]. With -c, users have more control of what their
> command-line looks like without having something forced on them.
>
> I can't see myself accepting this patch right now for the above reasons.
> On the other hand, I don't see any reason to alter the way proc_name is
> used in the future, so monkey patching here is fine.
>
> I'm sure there'll always be folks that will want something different in
> $0 (as evidenced by Rack::Contrib::ProcTitle and like).
>
>
> [1] - I try to be considerate of on-call folks working from mobile
> phones or netbooks and/or bad net connections. There's even
> a test in test_exec.rb to ensure the help output text can fit
> in standard 80x24 ANSI terminals. Personally, I refuse to use
> a terminals wider than 80 columns (actually, I would've
> preferred the world standardized on a 64-column wrap)
Fair enough, I realize the patch wasn't for everyone. I usually
change to the directory first and call unicorn with a relative path,
but that's probably just a bad habit. It's fairly easy to monkey
patch it in the configuration file if you need it:
class Unicorn::HttpServer
def proc_name(tag)
$0 = ([ File.basename(START_CTX[0]), File.basename(START_CTX[:cwd]),
tag ]).concat(START_CTX[:argv]).join(' ')
end
end
I see in the NEWS entry for 0.95.1 that you do recommend an absolute
path for the -c/--config-file option, but it may be beneficial to
mention this in the man page or other parts of the documentation.
Thanks,
Jeremy
_______________________________________________
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Show the current working directory in the proc title
2010-07-02 22:50 ` Jeremy Evans
@ 2010-07-05 23:34 ` Eric Wong
2010-07-06 2:18 ` Lawrence Pit
0 siblings, 1 reply; 5+ messages in thread
From: Eric Wong @ 2010-07-05 23:34 UTC (permalink / raw)
To: unicorn list
Jeremy Evans <jeremyevans0@gmail.com> wrote:
> I see in the NEWS entry for 0.95.1 that you do recommend an absolute
> path for the -c/--config-file option, but it may be beneficial to
> mention this in the man page or other parts of the documentation.
Agreed, thanks Jeremy!
>From d7695c25c5e3b1c90e63bf15a5c5fdf68bfd0c34 Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Mon, 5 Jul 2010 23:14:40 +0000
Subject: [PATCH] doc: recommend absolute paths for -c/--config-file
Suggested-by: Jeremy Evans
ref: http://mid.gmane.org/AANLkTintT4vHGEdueuG45_RwJqFCToHi5pm2-WKDSUMz@mail.gmail.com
---
Documentation/unicorn.1.txt | 3 +++
Documentation/unicorn_rails.1.txt | 7 +++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Documentation/unicorn.1.txt b/Documentation/unicorn.1.txt
index 24df7ab..c20a570 100644
--- a/Documentation/unicorn.1.txt
+++ b/Documentation/unicorn.1.txt
@@ -36,6 +36,9 @@ with rackup(1) but strongly discouraged.
implemented as a Ruby DSL, so Ruby code may executed.
See the RDoc/ri for the *Unicorn::Configurator* class for the full
list of directives available from the DSL.
+ Using an absolute path for for CONFIG_FILE is recommended as it
+ makes multiple instances of Unicorn easily distinguishable when
+ viewing ps(1) output.
-D, \--daemonize
: Run daemonized in the background. The process is detached from
diff --git a/Documentation/unicorn_rails.1.txt b/Documentation/unicorn_rails.1.txt
index 267e425..f426b07 100644
--- a/Documentation/unicorn_rails.1.txt
+++ b/Documentation/unicorn_rails.1.txt
@@ -34,8 +34,11 @@ as much as possible.
-c, \--config-file CONFIG_FILE
: Path to the Unicorn-specific config file. The config file is
implemented as a Ruby DSL, so Ruby code may executed.
- See the RDoc/ri for the *Unicorn::Configurator* class for the
- full list of directives available from the DSL.
+ See the RDoc/ri for the *Unicorn::Configurator* class for the full
+ list of directives available from the DSL.
+ Using an absolute path for for CONFIG_FILE is recommended as it
+ makes multiple instances of Unicorn easily distinguishable when
+ viewing ps(1) output.
-D, \--daemonize
: Run daemonized in the background. The process is detached from
--
Eric Wong
_______________________________________________
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Show the current working directory in the proc title
2010-07-05 23:34 ` Eric Wong
@ 2010-07-06 2:18 ` Lawrence Pit
0 siblings, 0 replies; 5+ messages in thread
From: Lawrence Pit @ 2010-07-06 2:18 UTC (permalink / raw)
To: unicorn list
The +after_fork+ doc mentions "generally there's no reason to start
Unicorn as a priviledged user".
"generally" that may be true, I'd still recommend to run each app as a
dedicated user.
The added bonus is that it makes it most obvious in ps(1) listings which
app a unicorn process belongs to as 'user' is usually mentioned first.
On small terminals the value of --config-file could easily be cut off at
the right, still leaving you in the dark.
Lawrence
> Jeremy Evans <jeremyevans0@gmail.com> wrote:
>
>> I see in the NEWS entry for 0.95.1 that you do recommend an absolute
>> path for the -c/--config-file option, but it may be beneficial to
>> mention this in the man page or other parts of the documentation.
>>
>
> Agreed, thanks Jeremy!
>
> >From d7695c25c5e3b1c90e63bf15a5c5fdf68bfd0c34 Mon Sep 17 00:00:00 2001
> From: Eric Wong <normalperson@yhbt.net>
> Date: Mon, 5 Jul 2010 23:14:40 +0000
> Subject: [PATCH] doc: recommend absolute paths for -c/--config-file
>
> Suggested-by: Jeremy Evans
> ref: http://mid.gmane.org/AANLkTintT4vHGEdueuG45_RwJqFCToHi5pm2-WKDSUMz@mail.gmail.com
> ---
> Documentation/unicorn.1.txt | 3 +++
> Documentation/unicorn_rails.1.txt | 7 +++++--
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/unicorn.1.txt b/Documentation/unicorn.1.txt
> index 24df7ab..c20a570 100644
> --- a/Documentation/unicorn.1.txt
> +++ b/Documentation/unicorn.1.txt
> @@ -36,6 +36,9 @@ with rackup(1) but strongly discouraged.
> implemented as a Ruby DSL, so Ruby code may executed.
> See the RDoc/ri for the *Unicorn::Configurator* class for the full
> list of directives available from the DSL.
> + Using an absolute path for for CONFIG_FILE is recommended as it
> + makes multiple instances of Unicorn easily distinguishable when
> + viewing ps(1) output.
>
> -D, \--daemonize
> : Run daemonized in the background. The process is detached from
> diff --git a/Documentation/unicorn_rails.1.txt b/Documentation/unicorn_rails.1.txt
> index 267e425..f426b07 100644
> --- a/Documentation/unicorn_rails.1.txt
> +++ b/Documentation/unicorn_rails.1.txt
> @@ -34,8 +34,11 @@ as much as possible.
> -c, \--config-file CONFIG_FILE
> : Path to the Unicorn-specific config file. The config file is
> implemented as a Ruby DSL, so Ruby code may executed.
> - See the RDoc/ri for the *Unicorn::Configurator* class for the
> - full list of directives available from the DSL.
> + See the RDoc/ri for the *Unicorn::Configurator* class for the full
> + list of directives available from the DSL.
> + Using an absolute path for for CONFIG_FILE is recommended as it
> + makes multiple instances of Unicorn easily distinguishable when
> + viewing ps(1) output.
>
> -D, \--daemonize
> : Run daemonized in the background. The process is detached from
>
_______________________________________________
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-07-06 2:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-02 20:50 [PATCH] Show the current working directory in the proc title Jeremy Evans
2010-07-02 22:29 ` Eric Wong
2010-07-02 22:50 ` Jeremy Evans
2010-07-05 23:34 ` Eric Wong
2010-07-06 2:18 ` Lawrence Pit
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).