【发布时间】:2010-08-18 01:04:48
【问题描述】:
所以,当我运行这段代码时,它似乎对系统进行了分叉炸弹,你们能帮帮我吗?我要做的就是为每个 appWatch 域和环境启动一个线程。
#!/usr/bin/perl
#
#
# Starts the mass processes to watch each directory & enviroment.
#
#
#
###################################################################################
use strict;
use warnings;
use POSIX 'setsid';
setsid();
my @domains = (qw(austin batman luke heman drevil joker skeltor drevil goodguy badguy));
my @envs = (qw(qa dev));
foreach my $env (@envs){
foreach my $guy (@domains){
unless(my $pid = fork()){
system("echo $env.$guy");
system("sleep 10 ");
#system("./appWatch -d $guy -e $env");
open PID, ">>pid.lock";
print PID $$ . "\n";
print "$$ is Parent, $pid is child";
}
}
}
wait();
【问题讨论】: