I am using Parallel::ForkManager to run multiple ssh sessions on various remote 
hosts. It is working fine.

Sometimes I have a problem: problem is in Net::OpenSSH module that, for 
whatever reason, when far end does not respond the module does not close the 
SSH connection (i.e. timeout is not working).

and, i am running ssh sessions inside forkmanager forked sessions. so i am 
wondering if there is anything I can use from forkmanager to terminate a child 
session based on some timeout value?

I read Parallel::ForkManager documentation, but to me it looks like i can not. 
is there anyone more experienced on this, who can help?


basic logic:


foreach $host (@hostlist) {
        my $pm->start($host) and next;

        my $ssh = Net::OpenSSH->new($host,
                                master_opts => [-o => 
'StrictHostKeyChecking=no',
                                                     -o => 'ConnectTimeout 30'],
                                );

    ...then some useful work thru ssh....
    ...
    undef $ssh;
    $pm->finish;

}


ty.
Rajeev

Reply via email to