jalebie has asked for the wisdom of the Perl Monks concerning the following question:
foreach $host (@hosts) { chomp ($host); my $templocal = "tmpclean.local.prl"; my $cmd_rsh ="/bin/rshto -to 60"; $pid = fork; if ($pid == 0) { # child print "$cmd_rsh $host $templocal 2 \n"; open(PIPEHANDLE, "$cmd_rsh $host $templocal 2 |"); my @output = <PIPEHANDLE>; close PIPEHANDLE; open(OUTFILE, ">> $output_file"); print OUTFILE @output; close OUTFILE; exit 1; } else { push(@pids,$pid); } if ($#pids > 10) { print "more than 10 processes running \n"; my $id = waitpid(-1,0); while (!(WIFEXITED($?)) ) {} $#pids = -1; #sleep 5; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do you wait for a process to end ?
by VSarkiss (Monsignor) on Aug 23, 2001 at 18:48 UTC | |
by jalebie (Acolyte) on Aug 23, 2001 at 19:03 UTC | |
by VSarkiss (Monsignor) on Aug 23, 2001 at 19:34 UTC | |
by claree0 (Hermit) on Aug 23, 2001 at 19:36 UTC | |
|
Re: How do you wait for a process to end ?
by claree0 (Hermit) on Aug 23, 2001 at 18:33 UTC | |
by tilly (Archbishop) on Aug 24, 2001 at 07:49 UTC | |
by Philgarr (Novice) on Aug 24, 2001 at 22:21 UTC | |
by tilly (Archbishop) on Aug 24, 2001 at 23:23 UTC | |
|
Re: How do you wait for a process to end ?
by fokat (Deacon) on Aug 24, 2001 at 03:27 UTC |