Cannot restart thin through remote computer

I use Thin to service the rails application located on the test machine. I would like to be able to stop / start thin work from my local machine, but the following does not work:

ssh luc@test_machine '/home/luc/.rvm/gems/ruby-1.9.3-p125/bin/thin -v'

The following error message appeared:

/home/luc/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find thin (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
from /home/luc/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/luc/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1230:in `gem'
from /home/luc/.rvm/gems/ruby-1.9.3-p125/bin/thin:18:in `<main>'

Why does he list only 6 gems when I have grades?

When I am connected to ssh on a test server:

which thin

gives the correct way:

/home/luc/.rvm/gems/ruby-1.9.3-p125/bin/thin  (question updated with correct path)

UPDATE

I created a basic test.sh script on the server:

#!/bin/bash
# Update path with ruby / gem
export PATH=$PATH:/home/luc/.rvm/rubies/ruby-1.9.3-p125/bin:/home/luc/.rvm/gems/ruby-1.9.3-p125/bin/
thin -v
exit 0

I call this from my local machine

ssh luc@test_machine '/home/luc/test.sh'

But still, the same β€œcould not find a subtle” error.

UPDATE 2

This may be due to rubies / gemset used when the script is executed via ssh. I added

rvm list
rvm gemset list

in the test.sh file, and I have the output:

rvm rubies

* ruby-1.9.3-p125 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

gemsets for system (found in /home/luc/.rvm/gems/system)
*

, , , ... , rubies/gemset ssh-, .

0
3

, . , , gem "rerun" (https://github.com/alexch/rerun), - .

rerun -- thin start

0

?

bundle exec thin -v

bundler, $PATH,

echo PATH

, , , - :) --

rvm gem wrappers,

http://beginrescueend.com/integration/god/

!

0

these solutions worked for me (remote and capistrano!)

look at the answer !

just a place:

source "/usr/local/rvm/scripts/rvm" # or ~/.rvm/..
rvm use 1.9.3

in / etc / init.d / thin

or for capistrano

%w[start stop restart].each do |command|
  desc "#{command} thin server"
  task command, roles: :app do
    run "source '/usr/local/rvm/scripts/rvm' && rvm use 1.9.3 && service thin #{command}"
  end
  after "deploy:#{command}", "thin:#{command}"
end

if you installed rvm on one of the source change paths of the user to '~ / .rvm / scripts / rvm'

0
source

All Articles