File: 0.04.23a/server/bin/test-threaded.sh (View as HTML)

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