Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: simple iterate and run cmd script

by KPeter0314 (Deacon)
on Jun 24, 2003 at 14:57 UTC ( [id://268541]=note: print w/replies, xml ) Need Help??


in reply to simple iterate and run cmd script

I use Net::SSH like this:

use Net::SSH qw(sshopen3); use strict; use warnings; # Watch for children and reap them. This is to avoid zombies left by +the ssh. $SIG{CHLD} = 'IGNORE'; my $command = "/usr/bin/date"; foreach $system (@system_list){ sshopen3( $system, *WRITER, *READER, *ERROR, $command ) || die "ssh +: $!"; while (<READER>) { chomp(); $date{$system} = $_; # Or do other stuff } close(READER); close(WRITER); close(ERROR); }
I feel it is easier to deal with the output this way.

Lots of stuff in Super Search where I learned this. There are other SSH modules, but this is the one I like.

-Kurt

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://268541]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-19 05:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found