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. -rgds, Rajeev