set_time_limit while thCount exec ps nasimke php wc -l echo thCount if

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
<?
set_time_limit(0);
while(1){
$thCount = exec("ps a | nasimke.php | wc -l");
echo $thCount."\r\n";
if($thCount < 10) {
for($i = 0; $i < 20; $i++){
echo "launch thread\r\n";
passthru("(php -f nasimke.php & ) >> /dev/null 2>&1");
//sleep(1);
}
} else {
sleep(5);
}
}