in reply to Net::OpenSSH and fork()
Anyway, when forking in perl it is usually a good idea to exit from the child processes using POSIX::_exit($code) that will NOT execute any cleanup code as destructors or END blocks.
Besides that, that is not the right way to use Net::OpenSSH that has built in support for running remote operations asynchronously (search in the docs for async or/and as sflitman has already pointed out, use the spawn method).
Finally, there is also Net::OpenSSH::Parallel:
use Net::OpenSSH::Parallel; my $pssh = Net::OpenSSH::Parallel->new; for my $server (@targets) { $pssh->add_host($server); } $pssh->push('*', command => @stuff); $pssh->push('*', command => @more_stuff); $pssh->run; # ... $pssh->push('*', command => @even_more_stuff); $pssh->run;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Net::OpenSSH and fork()
by scotchie (Novice) on Aug 03, 2010 at 18:55 UTC | |
by salva (Canon) on Aug 07, 2010 at 08:07 UTC | |
by scotchie (Novice) on Aug 17, 2010 at 17:16 UTC |