running a script file using pssh

6,467 views
Skip to first unread message

Raghava Mutharaju

unread,
Mar 10, 2011, 5:21:12 PM3/10/11
to parallel-ssh
Hello all,

Is it possible to run a script file instead of putting everything on
the command line in pssh?

Eg: pssh -h hosts.txt -o ~/prj/output ~/prj/test.sh

Instead of putting all the contents of test.sh on the command line
itself.

Regards,
Raghava.

Andrew McNabb

unread,
Mar 10, 2011, 6:18:31 PM3/10/11
to parall...@googlegroups.com
On Thu, Mar 10, 2011 at 02:21:12PM -0800, Raghava Mutharaju wrote:
>
> Is it possible to run a script file instead of putting everything on
> the command line in pssh?
>
> Eg: pssh -h hosts.txt -o ~/prj/output ~/prj/test.sh

The -I/--send-input option may be what you're looking for. From the man
page:

"""Read input and send to each ssh process. Since ssh allows a
command script to be sent on standard input, the -I option may be used
in lieu of the command argument."""

Your example would become:

pssh -h hosts.txt -o ~/prj/output -I < ~/prj/test.sh

Let us know if it works for you.

--
Andrew McNabb
http://www.mcnabbs.org/andrew/
PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868

Raghava Mutharaju

unread,
Mar 10, 2011, 9:48:58 PM3/10/11
to parall...@googlegroups.com
Hello Andrew,

Thank you for the reply. I tried the following

./pssh -h ../hosts.txt -P -l<../test.sh

But I get the following error: 

Usage: pssh [OPTIONS] command [...]
pssh: error: -l option requires an argument

What could be the issue here?

Regards,
Raghava.

Andrew McNabb

unread,
Mar 10, 2011, 10:37:13 PM3/10/11
to parall...@googlegroups.com
On Thu, Mar 10, 2011 at 09:48:58PM -0500, Raghava Mutharaju wrote:
>
> Thank you for the reply. I tried the following
>
> ./pssh -h ../hosts.txt -P -l<../test.sh
>
> But I get the following error:
>
> Usage: pssh [OPTIONS] command [...]
> pssh: error: -l option requires an argument
>
> What could be the issue here?

Your font might be the issue. :) That should be a capital letter i, not
a lower-case L. It's an easy mistake with a bad font. :)

Raghava Mutharaju

unread,
Mar 10, 2011, 11:31:37 PM3/10/11
to parall...@googlegroups.com, Andrew McNabb
Yes, that was the problem :), thank you. Now, it works fine.

Regards,
Raghava.

parul chourasia

unread,
Feb 19, 2016, 9:12:04 AM2/19/16
to parallel-ssh


Hi,

I am getting beow error when i do the above command as said by you :

 ./pssh -h input.txt -P -I< ./restartcollector_final.sh
Error: option -I not recognized

Usage: pssh [OPTIONS] -h hosts.txt prog [arg0] ..

  -h --hosts   hosts file (each line "host[:port] [user]")
  -l --user    username (OPTIONAL)
  -p --par     max number of parallel threads (OPTIONAL)
  -o --outdir  output directory for stdout files (OPTIONAL)
  -e --errdir  output directory for stderr files (OPTIONAL)
  -t --timeout timeout (secs) (-1 = no timeout) per host (OPTIONAL)
  -O --options SSH options (OPTIONAL)
  -v --verbose turn on warning and diagnostic messages (OPTIONAL)
  -P --print   print output as we get it (OPTIONAL)
  -i --inline  inline aggregated output for each server (OPTIONAL)

Example: pssh -h nodes.txt -l irb2 -o /tmp/foo uptime


please suggest what needs to be done

Kev Smith

unread,
Feb 19, 2016, 9:28:18 AM2/19/16
to parall...@googlegroups.com
the -l is OPTIONAL - if you supply the param it is expecting an ARGUMENT IE a username to connect with

try

 ./pssh -h input.txt -P < ./restartcollector_final.sh

OR

./pssh -h input.txt -P -l YOUR_USER < ./restartcollector_final.sh


--

---
You received this message because you are subscribed to the Google Groups "parallel-ssh" group.
To unsubscribe from this group and stop receiving emails from it, send an email to parallel-ssh...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages