我需要运行以下Ubuntu bash脚本作为" sudo" (仅供参考,这是因为我通过Upstart运行它):
cd /u/apps/MyRailsApp/current && /usr/bin/env RAILS_ENV=production script/delayed_job restart >> /var/log/upstart/delayed_job.log
但是,当我将其作为" sudo"运行时,我收到以下错误:
首先 /var/lib/gems/1.9.1/gems/bundler-1.7.6/lib/bundler/source/git.rb:188:in rescue in load_spec_files': git@github.com:MyRemoteRepo/my_gem.git (at 1.0.1) is not yet checked out. Run
bundle install`。 (捆扎机:: GitError)
不建议运行"捆绑安装"作为Sudo。当我运行"捆绑安装"作为非管理员用户,它正在运行并且所有宝石都被识别。如何让root用户识别gem?
宝石在/home/ubuntu/.bundler/ruby/1.9.1/中。我的其他宝石在/var/lib/gems/1.9.1/gems /
非常感谢你的帮助。
答案 0 :(得分:0)
尝试添加“source /home/[username]/.bashrc”,其中[username]是非管理员用户,可以成功运行脚本。