1
pssh -h host.txt -X cscuser /bin/bash<<< 'gnome-terminal;cat /etc/resolv.conf'

I tried to use this to open multiple terminal on my clients computers but I get errors like

[1] 14:34:31 [FAILURE] 10.20.10.214 Exited with error code 255
[2] 14:34:31 [FAILURE] 10.20.10.201 Exited with error code 255

I need to open terminals on my client's computer OR run top commands to get CPU usage in parallel. How can I do this?

Zanna
  • 70,465

1 Answers1

1

You can do this using the following command.

pssh -h <hostfile> -l <username> "-O StrictHostKeyChecking=no" -A -i "top -b -n1"

Change <hostfile> to the file name of you host file, and change <username> to the remote username.

You can remove the "-O StrictHostKeyChecking=no" option if this is not the first time you are connecting to the machine using pssh or ssh.

You have to run the top command in batch mode as you are running it via remote. Thats why we used -b flag with top

-n means number of iterations. So if we set it to 1 (-n1), then it will give one instance of top output. You can change the value to get more instances.

-i used to get the standers output and standers error as each host completes

-A used to get the prompt for a password and pass it to ssh. If you are using ssh keys, then you can exclude this flag.

Zanna
  • 70,465
ran
  • 375