mina-deploy / mina

Blazing fast deployer and server automation tool
https://rubygems.org/gems/mina
Other
4.35k stars 490 forks source link

`remote` command doesn't find my executable (after upgrade from 0.3 to 1.0) #513

Closed jmuheim closed 7 years ago

jmuheim commented 7 years ago

I have the following custom task:

desc "Performs a backup."
task backup: :environment do
  comment 'Performing backup'
  command %{backup perform --trigger=audit}
end

It gives the following error:

$ mina backup
-----> Performing backup
       bash: line 1: backup: command not found
       Connection to zugangfueralle01.nine.ch closed.

 !     Run Error

But when manually ssh'ing to the server and executing $ backup perform --trigger=audit, it works well.

Does remote miss some configuration which is loaded when ssh'ing manually?

Interestingly, this very same task worked perfectly in v0.3, but after upgrading to 1.0, it doesn't anymore

jmuheim commented 7 years ago

Probably better a question on StackOverflow:

http://stackoverflow.com/questions/42007271/mina-deploy-remote-command-doesnt-find-my-executable

jmuheim commented 7 years ago

I found a workaround, just load the env manually in the environment:

task :environment do
  command %{source $HOME/.bash_profile; source $HOME/.bashrc;}
end

But why isn't this done automatically anymore?

d4be4st commented 7 years ago

This is because how your bash_profile is written

There is a line on the top:

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

which exits bash rc and does not go to the end, and i assume your program is sources at the end of your bashrc file

jmuheim commented 4 years ago

Just wanted to mention that it now works. I don't know, maybe a gem version update, or a change on the server side...