Hi All, I want to get the environment name in which the application is executing whether in production or in development etc using the bash script and want to write that result into the .sh file. Not by using the ruby. Any ideas of how to get this work? -- Cheers, Rafi *In Every moment, thank God.* -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mon, Feb 13, 2012 at 1:39 PM, Rafi A <rafiglitz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi All, > > I want to get the environment name in which the application is executing > whether in production or in development etc using the bash script and want > to write that result into the .sh file. Not by using the ruby. Any ideas of > how to get this work? >Do you mean the environment on a "bash" level ? Well, when passenger is used, you could check the RAILS_ENV value Maybe this is useful ? http://www.modrails.com/documentation/Users%20guide%20Nginx.html#RailsEnv HTH, Peter -- *** Available for a new project *** Peter Vandenabeele http://twitter.com/peter_v http://rails.vandenabeele.com http://coderwall.com/peter_v -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 13 February 2012 12:39, Rafi A <rafiglitz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi All, > > I want to get the environment name in which the application is executing > whether in production or in development etc using the bash script and want > to write that result into the .sh file. Not by using the ruby. Any ideas of > how to get this work?Do you mean you have a rails server running, and from a separate bash script want to know whether the rails server is running in production or development or whatever, without doing anything special in the rails app? Tricky I think.> Rafi > In Every moment, thank God.Generally I think you are more likely to get help if you do not attempt to force religious ideas on people. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You could use the rails runner and do something like # add rails bin dir to path first! RAILS_ENV=`rails runner "puts Rails.env"` That said, if this is something you need access to regularly, add initializer code to your app to write the end out to a well know file name under the project that scripts can read without the overhead of spinning up the app to get that info, scraping logs, etc Max On 2/13/12, Rafi A <rafiglitz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi All, > > I want to get the environment name in which the application is executing > whether in production or in development etc using the bash script and want > to write that result into the .sh file. Not by using the ruby. Any ideas of > how to get this work? > > -- > Cheers, > Rafi > *In Every moment, thank God.* > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.