#!/usr/bin/perl use threads; use Net::SSH::Perl; sub thread_routine { if ($i<=9) { $server = 's0'. $i; } else { $server = 's'. $i; } printf ( "Подключаемся к $server\n"); my $ssh = Net::SSH::Perl ->new($server); $ssh->login("user", "xxx"); $cmd = 'df -k'; my ($out, $err, $exit) = $ssh->cmd($cmd); print ( "$out"); return $i; } foreach $i (1..10) { push @threads,threads->create('thread_routine',$i); } foreach $thread (@threads) { $thread->join(); } Connect to s01
Connect to s02
Connect to s03
Connect to s04
...
Connect to s10
Segmentation error (memory dump made)