File: 1.00.10a/server/bin/test-threaded.php (View as Code)

1: 2: require("include.php"); 3: $NATS->Start(); 4: 5: echo "test-threaded.sh: spawning node tester processes\n"; 6: $q="SELECT nodeid FROM fnnode WHERE nodeenabled>0 ORDER BY weight ASC"; 7: $r=$NATS->DB->Query($q); 8: $spawn_delay=$NATS->Cfg->Get("test.spawndelay",0); 9: //echo "Delay: ".$spawn_delay."\n"; 10: if ($spawn_delay>0) $spawn_delay=$spawn_delay*1000000; // convert to us (microseconds / millionths) 11: //echo "Delay: ".$spawn_delay."\n"; 12: $first=true; 13: while ($row=$NATS->DB->Fetch_Array($r)) 14: { 15: if ($first) $first=false; 16: else 17: { 18: // Test Execution Delay / test.spawndelay 19: if ($spawn_delay>0) usleep($spawn_delay); 20: } 21: $cmd="php ./tester.php ".$row['nodeid']." > /tmp/nr.".$row['nodeid']." &"; 22: echo $cmd."\n"; 23: exec($cmd); 24: } 25: $NATS->DB->Free($r); 26: $NATS->Stop(); 27: ?> 28: 29: