i have run a rails project on my server, and i use ssh to connect server to start/stop/restart rails project with terminal, if i do not close the terminal, it run well, but when i close the terminal, the project begin to raise error like(but not always):
LoadError (cannot load such file -- devise/parameter_filter) ....
and so on.
when i lsof the process, i found the rvm path is change,
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ruby 18168 wacom cwd DIR 252,0 4096 2108629 /app/service/wacom/releases/20131215130012 ruby 18168 wacom rtd DIR 252,0 4096 2 / ruby 18168 wacom txt REG 0,22 112181 139104 /.rvm/rubies/ruby-2.0.0-p247/bin/ruby ruby 18168 wacom mem REG 0,22 220552 1053141 /.rvm/gems/ruby-2.0.0-p247/gems/bcrypt-ruby-3.1.2/lib/bcrypt_ext.so .........
but when i keep the terminal open, it run well, and lsof result is
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ruby 18168 wacom cwd DIR 252,0 4096 2108629 /app/service/wacom/releases/20131215130012 ruby 18168 wacom rtd DIR 252,0 4096 2 / ruby 18168 wacom txt REG 0,22 112181 139104 /home/wacom/.rvm/rubies/ruby-2.0.0-p247/bin/ruby ruby 18168 wacom mem REG 0,22 220552 1053141 /home/wacom/.rvm/gems/ruby-2.0.0-p247/gems/bcrypt-ruby-3.1.2/lib/bcrypt_ext.so .......
i have set [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" on .bashrc and have source ~/.rvm/scripts/rvm
anyone has the same problem or can help me? thx!!
you need to use wrappers, they will ensure proper ruby environment, since rvm 1.25 it is:
ls `gem env gemhome`/wrappers/unicorn_rails
also check example scripts for working with rvm and ruby environment => http://rvm.io/integration/init-d
i found that our server system has used ecryptfs
,so when user logout, the user dir will umount, then system can not found the rvm path in user dir and redirect to /.rvm ! thanks all to answer my question!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.