3

I'm trying to run a simple bat file on Windows that will run a bash script on a remote Linux machine. The bash script is located on the Linux machine.

For example: I'm trying to run this command in a batch file on Windows:

plink.exe -pw <password> root@<ip> bash -c "/root/script.sh"

Result:

  • When running from windows the cmd is stuck forever
  • When running the specific script (/root/script.sh) from the Linux machine it's working just fine.
  • The script contain ruby code and I'm using RVM
Attie
  • 20,734
user128877
  • 131
  • 1
  • 1
  • 2

1 Answers1

0

what do you see if you run the following? this will step through the script.

plink.exe -pw <password> root@<ip> bash -x "/root/script.sh"

also, be aware that the environment set up is different when you run remotely. you must make sure that all that is set up properly, such as PATH. so your script must say either /usr/bin/ruby instead of ruby, or add /usr/bin in the PATH, etc.

Or source a file that will set them up.

johnshen64
  • 4,701