Call ruby script from another user not using rvm -


when need run script linux user "user1", following commands (right after login "user1"):

rvm use 1.9.3 cd /var/proj ruby main.rb 

when developing script, have created bundle bundle install, reading gemfile (containing httparty , other stuff).

this working fine (no reason not work :) )

when log user "user2", i'd execute script cannot have working:

cd /var/proj /home/user1/.rvm/rubies/ruby-1.9.3-p327/bin/ruby main.rb 

the error get:

/home/user1/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- httparty (loaderror) /home/user1/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' main.rb:3:in `<main>' 

it seems cannot see bundle created other user. idea of needs changed ?

i'd run script within supervisor same thing.

it not recommended can use rvm other a/c . set rvm required path in user a/c.

details instruction:

first go user1 , follow steps

  rvm use 1.9.3   echo $path 

now copy path include rvm word , in case

/home/paritosh/.rvm/gems/ruby-1.9.3-p194/bin:/home/paritosh/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/paritosh/.rvm/rubies/ruby-1.9.3-p194/bin:/home/paritosh/.rvm/bin  

now go user2 a/c , use path=copied_path:$path in case

path=/home/paritosh/.rvm/gems/ruby-1.9.3-p194/bin:/home/paritosh/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/paritosh/.rvm/rubies/ruby-1.9.3-p194/bin:/home/paritosh/.rvm/bin:$path 

now go

 cd /var/proj   ruby main.rb 

btw, if want make path permanent put path in ~/.bashrc of user2 a/c .


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -