how good is Net::OpenSSH::Parallel in your experience
how good is Net::OpenSSH::Parallel in your experience
am 11.09.2011 01:35:07 von Rajeev Prasad
--0-1579457088-1315697707=:81547
Content-Type: text/plain; charset=us-ascii
Hi
i am planning to use this module, but its version is 0.11 ! and author says it is beta quality. i am using Net::OpenSSH which is also below ver 1.0 but i have had no issues with it so far.
does anyone have any good/bad experience with this module?
thank you.
Rajeev
--0-1579457088-1315697707=:81547--
Re: how good is Net::OpenSSH::Parallel in your experience
am 11.09.2011 02:32:58 von Paul Johnson
On Sat, Sep 10, 2011 at 04:35:07PM -0700, Rajeev Prasad wrote:
> Hi
>
> i am planning to use this module, but its version is 0.11 ! and author says it is beta quality. i am using Net::OpenSSH which is also below ver 1.0 but i have had no issues with it so far.
>
> does anyone have any good/bad experience with this module?
I don't, but I think you are probbaly reading far too much into both the
version number and its described status. 0.11 may well mean that the module
has had 11 releases. Would you consider that good or bad? It depends, I
suppose.
And beta quality? That *should* mean that the author believes the module is
complete, functional and working apart from any already noted bugs, and it is
now ready for further testing in real world situations by real users. That
seems to be pretty good quality to me.
The trouble is that too many companies have sold software, often for large
sums of money, and that software is full of bugs or lacking in functionality.
Is it any wonder that people then worry about the quality of beta or alpha
software?
See http://pjcj.sytes.net/notes/2007/03/14#alpha for more of my thoughts on
this subject with specific reference to one of my modules, which has now had
79 releases over 10 years and is thus up to version 0.79.
It's possible that the module is complete rubbish. Or it may be practically
perfect in every way. But you're not going to find out from the version
number or described status. Asking for opinions is a much better strategy,
but ultimately you'll need to try it for yourself and see if it does what you
want.
--
Paul Johnson - paul@pjcj.net
http://www.pjcj.net
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/
Re: how good is Net::OpenSSH::Parallel in your experience
am 11.09.2011 08:04:44 von Shlomi Fish
On Sun, 11 Sep 2011 02:32:58 +0200
Paul Johnson wrote:
> On Sat, Sep 10, 2011 at 04:35:07PM -0700, Rajeev Prasad wrote:
>=20
> > Hi
> >=20
> > i am planning to use this module, but its version is 0.11 ! and author =
says it is beta quality. i am using Net::OpenSSH which is also below ver 1=
..0 but i have had no issues with it so far.
> >=20
> > does anyone have any good/bad experience with this module?
>=20
> I don't, but I think you are probbaly reading far too much into both the
> version number and its described status. 0.11 may well mean that the mod=
ule
> has had 11 releases. Would you consider that good or bad? It depends, I
> suppose.
>=20
> And beta quality? That *should* mean that the author believes the module=
is
> complete, functional and working apart from any already noted bugs, and i=
t is
> now ready for further testing in real world situations by real users. Th=
at
> seems to be pretty good quality to me.
Indeed. As Eric Raymond notes in:
http://www.catb.org/~esr/writings/cathedral-bazaar/homestead ing/ar01s13.html
<<<
This rule underlies the fact that open-source software tends to stay in bet=
a for a long time, and not get even a 1.0 version number until the develope=
rs are very sure it will not hand out a lot of nasty surprises. In the clos=
ed-source world, Version 1.0 means ``Don't touch this if you're prudent.'';=
in the open-source world it reads something more like ``The developers are=
willing to bet their reputations on this.''.
>>>
Also there's some discussion of Padre reaching version 1.0 here:
http://mailman.jach.hawaii.edu/pipermail/perldl/2010-April/0 02930.html
And I should note that most of my original modules on
http://search.cpan.org/~shlomif/ are below 1.0 (possibly the only exception=
is HTML-Widgets-NavMenu, where I bumped the middle version digit too liber=
ally and had to release 1.0), and yet they should be usable.
On the fun side see this IRC conversation:
<<<<<<<<<<<<<<<<<<<
btw, you can do mplayer -dumpaudio -dumpfile file.mp3
no need to reencode
This -dumpfile is a nice trick.
Is it new?
I wonder when mplayer will hit 1.0 already.
Ah.
All the stuff I saw told me to use WAV and then encode.
mplayer and 1.0? i'm not really sure it's their goal
They will stay at 1.0RC-foo forever?
although i would be glad if they had some sensible versioning
Yes.
At the moment perl-Mojolicious is at 0.999924.
At least perl-Moose hit 1.00
lol
Without any substantial changes from 0.99.
But you've got to upgrade somehow.
perl-Moose is MDV/RH notation, but I like it.
imo it's just stupid not to release 1.0
I dislike libmoose-perl
Yes.
wine did so and now they have normal versioning
Though most of my CPAN modules are sub-1.0.
http://search.cpan.org/~shlomif/
I think except for one module (where I used 0.2.0 0.4.0 and
eventually hit 0.8.0 and had to go to 1.000) all my 1.0 and
above modules are adopted.
they are sub-1.0, but they are not 0.9.999.2010.03.11-rc5
:)
One of them used the CVS revisions as versions.
d3x : LOL.
Yes.
d3x: can I quote you on that?
i say it's stupid to make releases up to 0.9.something and
then not to release 1.0
I collect quotes on my homepage.
sure you can
At the moment I have freecell-solver-2.42.0
But I hope the new release will be 3.0.0
the one that was bought by freecell enterprise? :D
I've left GNOME and gtk+/glib behind.
d3x yes.
Freecell Solver Enterprisesâ=A2 Inc.
Ah, so you've seen that.
yes, you posted a link on #debian
Yes.
You should add a digest to the version.
0.9.999.2010.03.11-rc5-adc83b19e793491b1c6ea0fd8b46cd9f32e59 2fc
lol
In case you're using git or hg.
-- d3x and Shlomi Fish (rindolf) about FOSS Versioning
-- private conversation, Freenode
>>>>>>>>>>>>>>>>>>>
(from
http://www.shlomifish.org/humour/fortunes/show.cgi?id=3Dd3x- and-shlomif-abo=
ut-foss-versioning ).
Regards,
Shlomi Fish
--=20
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Escape from GNU Autohell - http://www.shlomifish.org/open-source/anti/autoh=
ell/
To err is human; to apologise â=94 divine.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/
Re: how good is Net::OpenSSH::Parallel in your experience
am 11.09.2011 19:19:22 von Rajeev Prasad
--0-1700057622-1315761562=:47064
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
thx guys, i was not aware of this version'ing view in open source.
=0A=
=0Aso i am now trying to use this module now. but i guess i have a very bas=
ic issue:
currently i am running following in a loop for all hosts (an=
d a inner loop for all commands for a host):
   my ($M=
FSSH) =3D Net::OpenSSH->new($HOST,
  Â=A0    =
            =
   user =3D> $USER,
  Â=A0   =C2=
=A0 Â Â Â Â Â Â Â Â Â Â Â =
    password =3D> $PASS,
  Â=A0  =
           =C2=
 Â=A0    default_stderr_fh =3D> $stderr_fh,
Â=
 Â=A0          =
         default_stdout_fh =
=3D> $stdout_fh,
  Â=A0       =
           =C2=
=A0 master_opts =3D> [-o =3D> 'StrictHostKeyChecking=3Dno',
 Â=A0=
           =C2=
Â=A0 Â Â Â Â Â Â Â Â Â Â =
           =C2=
=A0-o =3D> 'ConnectTimeout 10'],
  Â=A0    =
            =
   );
  Â=A0 $EXITCODE =3D $MFSSH->error;=0A=
   next if ($EXITCODE ne "0");    =C2=
Â=A0 Â Â Â #go to next host if ssh fails
 Â=A0=
 foreach $CMD (@MFCMDS){
  Â=A0 chomp($CMD);
Â=A0=
  ( @CMDRESULT, $CMDERR ) =3D $MFSSH->capture("$CMD");
Â=A0=
  }
how can i use Net::OpenSSH::Parallel this script?=
i mean i understood creating a new instance like pssh in the module CPAN p=
age, but not sure how to integrate it with the script i already have.
=
thx in advance.=0ARajeev
_______________________________ _=0AFrom=
: Shlomi Fish =0ATo: Paul Johnson =
=0ACc: Rajeev Prasad ; Perl Beginners
rg>=0ASent: Sunday, September 11, 2011 1:04 AM=0ASubject: Re: how good is N=
et::OpenSSH::Parallel in your experience
On Sun, 11 Sep 2011 02:32:58=
+0200=0APaul Johnson wrote:
> On Sat, Sep 10, 2011 at=
04:35:07PM -0700, Rajeev Prasad wrote:=0A> =0A> > Hi=0A> > =0A> > i am pla=
nning to use this module, but its version is 0.11 ! and author says it is b=
eta quality. i am using Net::OpenSSH which is also below ver 1.0 but =
i have had no issues with it so far.=0A> > =0A> > does anyone have any good=
/bad experience with this module?=0A> =0A> I don't, but I think you are pro=
bbaly reading far too much into both the=0A> version number and its describ=
ed status. 0.11 may well mean that the module=0A> has had 11 releases=
.. Would you consider that good or bad? It depends, I=0A> suppos=
e.=0A> =0A> And beta quality? That *should* mean that the author beli=
eves the module is=0A> complete, functional and working apart from any alre=
ady noted bugs, and it is=0A> now ready for further testing in real world s=
ituations by real users. That=0A> seems to be pretty good quality to =
me.
Indeed. As Eric Raymond notes in:
http://www.catb.org/~esr/wr=
itings/cathedral-bazaar/homesteading/ar01s13.html
<<<=0AThis rule unde=
rlies the fact that open-source software tends to stay in beta for a long t=
ime, and not get even a 1.0 version number until the developers are very su=
re it will not hand out a lot of nasty surprises. In the closed-source worl=
d, Version 1.0 means ``Don't touch this if you're prudent.''; in the open-s=
ource world it reads something more like ``The developers are willing to be=
t their reputations on this.''.=0A>>>
Also there's some discussion of =
Padre reaching version 1.0 here:
http://mailman.jach.hawaii.edu/piperm=
ail/perldl/2010-April/002930.html
And I should note that most of my or=
iginal modules on=0Ahttp://search.cpan.org/~shlomif/ are below 1.0 (possibl=
y the only exception is HTML-Widgets-NavMenu, where I bumped the middle ver=
sion digit too liberally and had to release 1.0), and yet they should be us=
able.
On the fun side see this IRC conversation:
<<<<<<<<<<<<<<<<=
<<<
Â=A0 Â Â btw, you can do mplayer -dumpaudio -dumpfi=
le file.mp3
Â=A0 Â Â no need to reencode=0A=C2=
=A0 This -dumpfile is a nice trick.=0AÂ Is it new?=0A
>Â I wonder when mplayer will hit 1.0 already.=0AÂ Ah.=
=0AÂ All the stuff I saw told me to use WAV and then encode.=
Â=A0 Â Â mplayer and 1.0? i'm not really sure it's the=
ir goal=0AÂ They will stay at 1.0RC-foo forever?
Â=A0 =C2=
=A0 Â although i would be glad if they had some sensible version=
ing=0AÂ Yes.=0AÂ At the moment perl-Mojolicious=
is at 0.999924.=0AÂ At least perl-Moose hit 1.00
Â=A0 =
  lol=0A Without any substantial changes f=
rom 0.99.=0AÂ But you've got to upgrade somehow.=0A=
 perl-Moose is MDV/RH notation, but I like it.
Â=A0 Â =
 imo it's just stupid not to release 1.0=0A I dislike =
libmoose-perl=0AÂ Yes.
Â=A0 Â Â wine did =
so and now they have normal versioning=0AÂ Though most of my =
CPAN modules are sub-1.0.=0AÂ http://search.cpan.org/~shlomif=
/=0AÂ I think except for one module (where I used 0.2.0 0.4.0=
and
Â=A0 Â Â Â Â Â eventually hit 0.8.0 and h=
ad to go to 1.000) all my 1.0 and
Â=A0 Â Â Â Â =C2=
=A0 above modules are adopted.
Â=A0 Â Â they are sub-1.=
0, but they are not 0.9.999.2010.03.11-rc5
Â=A0 Â Â :)=
=0AÂ One of them used the CVS revisions as versions.=0A
lf>Â d3x : LOL.=0AÂ Yes.=0AÂ d3x: can I qu=
ote you on that?
Â=A0 Â Â i say it's stupid to make rel=
eases up to 0.9.something and
Â=A0 Â Â Â Â Â t=
hen not to release 1.0=0AÂ I collect quotes on my homepage.=
Â=A0 Â Â sure you can=0AÂ At the moment =
I have freecell-solver-2.42.0=0AÂ But I hope the new release =
will be 3.0.0
Â=A0 Â Â the one that was bought by freec=
ell enterprise? :D=0AÂ I've left GNOME and gtk+/glib behind.=
=0AÂ d3x yes.=0AÂ Freecell Solver Enterprises=
â=A2 Inc.=0AÂ Ah, so you've seen that.
Â=A0 Â =
 yes, you posted a link on #debian=0A Yes.=0A
dolf>Â You should add a digest to the version.=0AÂ 0.9.9=
99.2010.03.11-rc5-adc83b19e793491b1c6ea0fd8b46cd9f32e592fc=0 AÂ Â =
 lol=0A In case you're using git or hg.
=C2=
=A0 Â -- d3x and Shlomi Fish (rindolf) about FOSS Versioning
Â=A0 =
 -- private conversation, Freenode=0A>>>>>>>>>>>>>>>>>>>
(from=
=0Ahttp://www.shlomifish.org/humour/fortunes/show.cgi?id=3Dd 3x-and-shlomif-=
about-foss-versioning ).
Regards,
   Shlomi Fish=
=0A-- =0A--------------------------------------------------------- ---=
-----=0AShlomi Fish   http://www.shlomifish.org/=0AEscape=
from GNU Autohell - http://www.shlomifish.org/open-source/anti/autohell/=
To err is human; to apologise â=94 divine.
Please reply to =
list if it's a mailing list post - http://shlom.in/reply .
--=0ATo uns=
ubscribe, e-mail: beginners-unsubscribe@perl.org=0AFor additional commands,=
e-mail: beginners-help@perl.org=0Ahttp://learn.perl.org/
--0-1700057622-1315761562=:47064--
how to use Net::OpenSSH::Parallel
am 14.09.2011 23:57:28 von Rajeev Prasad
--239630641-1870636879-1316037448=:48427
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
trying to use this module now. but i guess i have a very basic issue:=
=0Acurrently i am running following in a loop for all hosts (and a in=
ner loop for all commands for a host):
=A0 my ($MFSSH) =3D Net::=
OpenSSH->new($HOST,
=A0 =A0 =A0 =A0 =A0=
=A0 user =3D> $USER,
=A0 =A0 =A0=
=A0 =A0 =A0 password =3D> $PASS,
=A0 =
=A0 =A0 =A0 =A0 =A0 default_stderr_fh =3D> $s=
tderr_fh,
=A0 =A0 =A0 =A0 =A0 =A0=
default_stdout_fh =3D> $stdout_fh,
=A0 =A0 =
=A0 =A0 =A0 =A0 master_opts =3D> [-o =3D> 'StrictHo=
stKeyChecking=3Dno',
=A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-o=
=3D> 'ConnectTimeout 10'],
=A0 =A0 =A0 =A0=
=A0 =A0 );
$EXITCODE =3D $MFSSH->error;=0A=
=A0 next if ($EXITCODE ne "0"); =A0 =A0 =A0 #go to n=
ext host if ssh fails
foreach $CMD (@MFCMDS){
chomp=
($CMD);
( @CMDRESULT, $CMDERR ) =3D $MFSSH->capture("$CMD");=0A=
=A0 }
how can i use Net::OpenSSH::Parallel this script? i =
mean i understood creating a new instance like pssh in the module CPAN page=
, but not sure how to integrate it with the script i already have.
thx=
in advance.=0ARajeev=0A
--239630641-1870636879-1316037448=:48427--
Re: how to use Net::OpenSSH::Parallel
am 16.09.2011 08:26:12 von salva
On Sep 14, 11:57=A0pm, rp.ne...@yahoo.com (Rajeev Prasad) wrote:
> trying to use this module now. but i guess i have a very basic issue:
>
> currently i am running following in a loop for all hosts (and a inner loo=
p for all commands for a host):
>
> =A0 my ($MFSSH) =3D Net::OpenSSH->new($HOST,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 use=
r =3D> $USER,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 pas=
sword =3D> $PASS,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 def=
ault_stderr_fh =3D> $stderr_fh,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 def=
ault_stdout_fh =3D> $stdout_fh,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 mas=
ter_opts =3D> [-o =3D> 'StrictHostKeyChecking=3Dno',
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
=A0 =A0 =A0 =A0 =A0-o =3D> 'ConnectTimeout 1=
0'],
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 );
> =A0 $EXITCODE =3D $MFSSH->error;
> =A0 next if ($EXITCODE ne "0"); =A0 =A0 =A0 #go to=
next host if ssh fails
> =A0 foreach $CMD (@MFCMDS){
> =A0 chomp($CMD);
> =A0 ( @CMDRESULT, $CMDERR ) =3D $MFSSH->capture("$CMD");
> =A0 }
>
> how can i use Net::OpenSSH::Parallel this script? i mean i understood cre=
ating a new instance like pssh in the module CPAN page, but not sure how to=
integrate it with the script i already have.
Net::OpenSSH::Parallel does not allow capturing directly the output of
commands into perl scalars. You have to redirect it to some file and
then reread it.
It would be easier to help you if you tells us what you need to do
from a higher level.
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/
Re: how to use Net::OpenSSH::Parallel
am 17.09.2011 18:15:10 von Rajeev Prasad
--1357089822-1271870649-1316276110=:73959
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
On Sep 14, 11:57=A0pm, rp.ne...@yahoo.com (Rajeev Prasad) wrote:=0A> trying=
to use this module now. but i guess i have a very basic issue:=0A>=0A> cur=
rently i am running following in a loop for all hosts (and a inner loop for=
all commands for a host):=0A>=0A> =A0 my ($MFSSH) =3D Net::OpenSSH->=
new($HOST,=0A> =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 user =3D> $USER,=0A> =A0 =A0 =A0 =A0 =A0=
=A0 =A0 password =3D> $PASS,=0A> =A0 =A0 =A0=
=A0 =A0 =A0 =A0 default_stderr_fh =3D> $stde=
rr_fh,=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0=
default_stdout_fh =3D> $stdout_fh,=0A> =A0 =A0 =A0=
=A0 =A0 =A0 =A0 master_opts =3D> [-o =3D> 'StrictH=
ostKeyChecking=3Dno',=0A> =A0 =A0 =A0 =A0 =A0=
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-=
o =3D> 'ConnectTimeout 10'],=0A> =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 );=0A> =A0 $EXITCODE =3D $MFSSH->error;=
=0A> =A0 next if ($EXITCODE ne "0"); =A0 =A0 =A0 #go=
to next host if ssh fails=0A> =A0 foreach $CMD (@MFCMDS){=0A> =
=A0 chomp($CMD);=0A> =A0 ( @CMDRESULT, $CMDERR ) =3D $MFSSH->capture(=
"$CMD");=0A> =A0 }=0A>=0A> how can i use Net::OpenSSH::Parallel this =
script? i mean i understood creating a new instance like pssh in the module=
CPAN page, but not sure how to integrate it with the script i already have=
..
Net::OpenSSH::Parallel does not allow capturing directly the output =
of=0Acommands into perl scalars. You have to redirect it to some file and=
=0Athen reread it.
It would be easier to help you if you tells us what=
you need to do=0Afrom a higher level.
-------------------------------=
-----
=0AHi Salva,=0AThx for responding. I need to SSH into several no=
des and run some commands there and capture the modified output to a file o=
n local node from where the script is run.
=0A-rgds,=0ARajeev
--1357089822-1271870649-1316276110=:73959--
Re: how to use Net::OpenSSH::Parallel
am 17.09.2011 19:21:56 von Shawn Wilson
--00151744102ec2b6ab04ad2658b9
Content-Type: text/plain; charset=ISO-8859-1
On Sep 17, 2011 12:16 PM, "Rajeev Prasad" wrote:
>
> On Sep 14, 11:57 pm, rp.ne...@yahoo.com (Rajeev Prasad) wrote:
> > trying to use this module now. but i guess i have a very basic issue:
> >
> > currently i am running following in a loop for all hosts (and a inner
loop for all commands for a host):
> >
> > my ($MFSSH) = Net::OpenSSH->new($HOST,
> > user => $USER,
> > password => $PASS,
> > default_stderr_fh => $stderr_fh,
> > default_stdout_fh => $stdout_fh,
> > master_opts => [-o =>
'StrictHostKeyChecking=no',
> > -o => 'ConnectTimeout
10'],
> > );
> > $EXITCODE = $MFSSH->error;
> > next if ($EXITCODE ne "0"); #go to next host if ssh fails
> > foreach $CMD (@MFCMDS){
> > chomp($CMD);
> > ( @CMDRESULT, $CMDERR ) = $MFSSH->capture("$CMD");
> > }
> >
> > how can i use Net::OpenSSH::Parallel this script? i mean i understood
creating a new instance like pssh in the module CPAN page, but not sure how
to integrate it with the script i already have.
>
> Net::OpenSSH::Parallel does not allow capturing directly the output of
> commands into perl scalars. You have to redirect it to some file and
> then reread it.
>
> It would be easier to help you if you tells us what you need to do
> from a higher level.
>
> ------------------------------------
>
> Hi Salva,
> Thx for responding. I need to SSH into several nodes and run some commands
there and capture the modified output to a file on local node from where the
script is run.
>
That's not saying what you want to do. That's saying what you think the
script should do in order to achieve a goal.
Now, I've never used that module but there's probably an anyevent module for
doing what you want. It might also be possible to use ipc::run objects which
might get you clover to what you want.
--00151744102ec2b6ab04ad2658b9--
Re: how to use Net::OpenSSH::Parallel
am 18.09.2011 17:20:25 von Rajeev Prasad
---1654579934-1503743141-1316359225=:84700
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
hi shawn/omega/salva,
=0Ai think there is some communication gap. so t=
o address my issue differently. can you guys plz. paste an example of code =
where you are usign this parallel module to ssh into many systems and, run =
some commands there (say you can use ls -l for your example) and change tha=
t output a bit=A0then, store the output in a file.
=0Ai think that exa=
mple will speak a thousand words and will take care of shortcomings in comm=
unication.
=0Ai did seacrh the net for examples on this module: i foun=
d none.
=0Athx.
From: shawn wilson =0ATo: =0A=
Cc: "beginners@perl.org" =0ASent: Saturday, September 1=
7, 2011 12:21 PM=0ASubject: Re: how to use Net::OpenSSH::Parallel
On S=
ep 17, 2011 12:16 PM, "Rajeev Prasad" wrote:=0A>=0A> O=
n Sep 14, 11:57 pm, rp.ne...@yahoo.com (Rajeev Prasad) wrote:=0A> > trying =
to use this module now. but i guess i have a very basic issue:=0A> >=0A> > =
currently i am running following in a loop for all hosts (and a inner=0Aloo=
p for all commands for a host):=0A> >=0A> >=A0 =A0 my ($MFSSH) =3D Net::Op=
enSSH->new($HOST,=0A> >=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 user =3D> $USER,=0A> >=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 password =3D> $PASS,=0A> >=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 default_stderr_fh =3D> $stderr_fh,=0A> >=A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 default_stdout_fh =3D> $stdout_fh,=
=0A> >=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 master_opts =
=3D> [-o =3D>=0A'StrictHostKeyChecking=3Dno',=0A> >=A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
-o =3D> 'ConnectTimeout=0A10'],=0A> >=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 );=0A> >=A0 =A0 $EXITCODE =3D $MFSSH->error;=0A> >=A0=
=A0 next if ($EXITCODE ne "0");=A0 =A0 =A0 =A0 =A0 =A0 #go to next host i=
f ssh fails=0A> >=A0 =A0 foreach $CMD (@MFCMDS){=0A> >=A0 =A0 chomp($CMD)=
;=0A> >=A0 =A0 ( @CMDRESULT, $CMDERR ) =3D $MFSSH->capture("$CMD");=0A> >=
=A0 =A0 }=0A> >=0A> > how can i use Net::OpenSSH::Parallel this script? i =
mean i understood=0Acreating a new instance like pssh in the module CPAN pa=
ge, but not sure how=0Ato integrate it with the script i already have.=0A>=
=0A> Net::OpenSSH::Parallel does not allow capturing directly the output of=
=0A> commands into perl scalars. You have to redirect it to some file and=
=0A> then reread it.=0A>=0A> It would be easier to help you if you tells us=
what you need to do=0A> from a higher level.=0A>=0A> ---------------------=
---------------=0A>=0A> Hi Salva,=0A> Thx for responding. I need to SSH int=
o several nodes and run some commands=0Athere and capture the modified outp=
ut to a file on local node from where the=0Ascript is run.=0A>
That's =
not saying what you want to do. That's saying what you think the=0Ascript s=
hould do in order to achieve a goal.
Now, I've never used that module =
but there's probably an anyevent module for=0Adoing what you want. It might=
also be possible to use ipc::run objects which=0Amight get you clover to w=
hat you want.
---1654579934-1503743141-1316359225=:84700--
Re: how to use Net::OpenSSH::Parallel
am 19.09.2011 12:28:19 von salva
On Sat, Sep 17, 2011 at 6:15 PM, Rajeev Prasad wrote:
> Hi Salva,
> Thx for responding. I need to SSH into several nodes and run some commands
> there and capture the modified output to a file on local node from where the
> script is run.
The easiest way to do that with Net::OpenSSH::Parallel is to retrieve
the unmodified output of the commands you are running to local files
and then postprocess them.
$pssh->push('*', cmd => {stdout_file => '/tmp/out-%HOST%'}, $cmd);
$pssh->run;
for my $host (@hosts) {
open my $fh, '<', "/tmp/out-$host" or die "$!";
while (<$fh>) {
...
}
}
You can also use an external program to process the output on the fly:
$pssh->push('*', cmd => {stdout_file => ['|-', 'grep foo
>/tmp/out-%HOST%']}, $cmd);
Or you can use the 'parsub' action to handle the output in perl
yourself (though, in a different process):
open my $out, '>', $filename or die $!;
sub worker {
my ($label, $ssh) = @_;
my $data = $ssh->capture($cmd);
my $processed_data = process($data);
flock($out, LOCK_EX);
print $out $processed_data;
flock($out, LOCK_UN);
}
$pssh->push("*", parsub => \&worker);
$pssh->run;
What you can't do with Net::OpenSSH::Parallel is to process the output
of the remote commands in the same process on the fly or to plug the
output of some command run in some host to the input of another
process running in a different host. If you want to do that, you
should go with some of the Perl event-based frameworks (AnyEvent, POE)
or use threads.
In my experience, the first approach I have described (using
intermediate temporal files) is usually the right one.
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/