Multithreading Ssh使用expect和线程?
您找到了如何使用expect with threads进行ssh的解决方案吗Multithreading Ssh使用expect和线程?,multithreading,perl,ssh,expect.pm,Multithreading,Perl,Ssh,Expect.pm,您找到了如何使用expect with threads进行ssh的解决方案吗 sub thDoWork { #variables my $thread_number = $_[0]; my $PassStoreQueue = $_[1]; my $Thread_Die = ''; my $My_Print_Bucket = ''; while ($Thread_Die ne 'KILL_THREAD') { my $tem
sub thDoWork {
#variables
my $thread_number = $_[0];
my $PassStoreQueue = $_[1];
my $Thread_Die = '';
my $My_Print_Bucket = '';
while ($Thread_Die ne 'KILL_THREAD') {
my $temp_Store_Number_Working_On = $PassStoreQueue->dequeue();
my $name;
my $ip;
my $Device_Exist;
my $TempDeviceName;
my $DNS_Results;
# I need to ssh inside many threads, I can ssh from the main
# thread just fine but not a sub thread.
$ssh = Expect->spawn("ssh -l $username1 $temp_ssh_device " .
"-o UserKnownHostsFile=/dev/null " .
"-o StrictHostKeyChecking=no")
or return "Couldn't spawn ssh session";
# this is unable to login to device.
}
我读到一个线程,该线程expect在线程中不能正常工作,这仍然是真的吗?事先创建一个
expect
对象,并将其传递给线程。看见这可能是重复的。可能是重复的。请事先创建expect
对象并将其传递给线程。看见这可能是一个副本。的可能副本