App-rcmd

 view release on metacpan or  search on metacpan

bin/rcmd  view on Meta::CPAN

  -l        list built-in commands and exit
  -h        print help and exit
EOF

# print help and exit
if ($h) {
    print "$desc\n$usage";
    exit;
}

my $private_key_path = $k || "";

# put built-in commands into a hash
my %Builtins;
while (<DATA>) {
    my ($name, $cmd) = split ' ', $_, 2;
    next unless $name; # skip empty lines in data
    $Builtins{$name} = $cmd;
}

# list built-in commands and exit

bin/rcmd  view on Meta::CPAN

} else {
    $user = getlogin || getpwuid($<) || die "Can't get current username";
}

# multiple connections are established (in parallel)
my %ssh;
for my $host (@hosts) {
    $ssh{$host} = Net::OpenSSH->new(
        $host,
        user    => $user,
        key_path => $private_key_path,
        async   => 1,
        timeout => 3,
        master_stderr_discard => 1,  # don't show the MOTD
    );
}

# run a command on all the hosts (sequentially) ...
for my $host (@hosts) {

    # if the supplied command is a name of a built-in command run that one



( run in 0.240 second using v1.01-cache-2.11-cpan-4d50c553e7e )