sub cleanup { while ((my $kpid = waitpid(-1,WNOHANG)) > 0) { delete($kids{$kpid}); $kidcount--; } } #### while ( $kidcount > 0) { my $secs = sleep 10; my $finishCount = $hostsfile->getCount - $kidcount; if ($secs == 10) { if ($outfile and $errfile) { print STDERR "Output is being logged into $outfile\n"; print STDERR "Errors are being logged into $errfile\n"; } print STDERR "\nFinished $finishCount hosts. following ($kidcount)hosts remaining:\n"; while ( my ($k, $v) = each %kids) { kill "USR1", $k; print STDERR "$v\n"; } print STDERR "\n"; } } #### sub killMyself { if ($waitcount > 6) { print STDERR "$serverName ERROR:: The host is hosed\n"; exit; } $waitcount++; }