1

I am trying to PSSH to multiple hosts, but instead of going to the home directory, i would like to go directly into a particular directory. Can anyone help me with how to do this? I have searched quite a lot for this, but without much luck.

At the moment my code looks like this:

pssh -h hosts.txt -P -i -v -l root -o . -I < downloadpkgs.sh

where hosts.txt contains the list of hosts and I want to execute the downloadpkgs shell script.

Thanks in advance!

Amittai Shapira
  • 3,749
  • 1
  • 30
  • 54
mkumar118
  • 442
  • 5
  • 12

1 Answers1

1

I found out how to do it.

pssh -h hosts.txt -P -i -v -l root -o . -x "cd /tmp; bash" -I < downloadpkgs.sh

In this way I login directly into the /tmp directory on all the remote machines.

Notice that it is important to specify bash after the cd /tmp.

Explanation: using the -x option of pssh. For more information about this flag read the manpage.

mkumar118
  • 442
  • 5
  • 12