Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

/bin/bash -l or su -l runs profile chruby but GEM_HOME and GEM_PATH are empty #236

Open
tpitale opened this Issue · 3 comments

2 participants

@tpitale

I've been trying to build a simple upstart config for a ruby script, but whenever it is run the GEM_HOME and GEM_PATH are empty.

Essentially, I've been trying to su -l -c "echo $GEM_HOME" deploy. I have /etc/profile.d/chruby.sh, and it is being run, and so is the sourced /usr/local/share/chruby/chruby.sh.

I'd be happy to provide any other information. Or maybe it's just obvious as to why this won't work.

@tpitale

Even inside the upstart script block, if I try to source /usr/local/share/chruby/chruby.sh and then chruby 1.9.3-p484 the GEM_HOME/GEM_PATH are empty.

chruby version is 0.3.8

@postmodern
Owner

There's several things going on here. First you want to run "echo \$GEM_HOME". Secondly, su -l -c isn't the same as bash -l -c.

       -, -l, --login
              Starts the shell as login shell with an environment similar to a
              real login:

                 o      clears all environment variables except for TERM

                 o      initializes  the  environment  variables  HOME, SHELL,
                        USER, LOGNAME, PATH

                 o      changes to the target user's home directory

                 o      sets argv[0] of the shell to '-' in order to make  the
                        shell a login shell

Although, I'm perplexed as to why calling chruby from within the upstart script doesn't work.

@tpitale
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.