Rails 【低级问题】su -c 命令执行和直接执行的区别?

dothide · September 20, 2014 · Last by beiersi replied at September 25, 2014 · 11049 hits

最近小弟部署了应用,发现一个奇葩的问题,在应用根目录直接使用bundle exec unicorn_rails -E production -D -c config/unicorn.rb 可以正常启动服务器 但是如果使用 su apps -c 'bundle exec unicorn_rails -E production -D -c config/unicorn.rb',就会报如下错误:

bundler: command not found: unicorn_rails
Install missing gem executables with 'bundle install'

真是费解啊,我已经配置好了 rvm,但始终没找到根本原因,求大神帮助

rvm 的问题吧,cd 到一个目录的时候,rvm 还会执行一些东西

项目根目录写个 .versions.conf su apps -c 'cd /path && bundle exec unicorn_rails -E production -D -c config/unicorn.rb'

或者

su apps -c 'cd /path && rvm 2.1.1@xxx do bundle exec unicorn_rails -E production -D -c config/unicorn.rb'

有一个 rvmsudo 命令

You need to Sign in before reply, if you don't have an account, please Sign up first.