Issues using pssh -I option in bash script

50 views Asked by At

I'm trying to use the -I option of pssh (parallel ssh) in a bash script and am having difficulties. This option should allow you to execute a script on your local machine on a remote machine. I've tried doing a very simple one for testing but can't seem to figure out the problem. I found this thread but pssh was run from the command line instead, that part works.

First, I have 3 different scripts

test - this gets put into the remote server's /tmp directory. it's not bash, just plain text used for a program's shell

testa - calls a command that uses test.

test3 - uses pscp to send test to /tmp and pssh to run testa.sh on the remote system

test3 contains the following:

#!/bin/bash
set -x
send="pscp.pssh -H 10.1.1.1 -l user /home/user/test /tmp/"
axe="pssh -H 10.1.1.1 -l user -I<./testa -x -tt"
${send}
${axe}
set +x

Here is the error I get:

+ pssh -H 10.1.1.1 -l user '-I<./testa' -x -tt
Usage: pssh [OPTIONS] command [...]

pssh: error: no such option: -<
+ set +x

The pscp part works fine, and I've just been sending both test and testa with pscp and executing testa on the remote server as a workaround, but I'd rather not send that one. From the debug it looks like single quotes are getting added around the -I for some reason. I've tried using -I<(./testa.sh) and still the same thing, though I can run the same command from the command line without a problem. This is on Centos 7 by the way, pssh version 2.3.1 and bash 4.2.46

0

There are 0 answers