TBDB_LINKTEST_MAX) { return "failed:Linktest level ($level) must be an integer ". "1 <= level <= ". TBDB_LINKTEST_MAX; } # For backend script call. TBGroupUnixInfo($pid, $gid, $unix_gid, $unix_name); # Make sure we shutdown if client goes away. register_shutdown_function("SPEWCLEANUP"); ignore_user_abort(1); set_time_limit(0); # # Having problems with popen reporting the proper exit status, # so switched to proc_open instead. Obtuse, I know. # $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w")); $process = proc_open("$TBSUEXEC_PATH ". "$uid $pid,$unix_gid weblinktest -l $level $pid $eid", $descriptorspec, $pipes); if (! is_resource($process)) { return "failed:Linktest failed!"; } $GLOBALS["process"] = $process; fclose($pipes[0]); # Build up an output string to return to caller. $output = "Starting linktest run at level $level on " . date("D M d G:i:s T") . "\n"; while (!feof($pipes[1])) { $string = fgets($pipes[1], 1024); $output .= $string; } fclose($pipes[1]); $retval = proc_close($process); $fp = 0; if ($retval > 0) { $output .= "Linktest reported errors! Stopped at " . date("D M d G:i:s T") . "\n"; return "error:$output"; } elseif ($retval < 0) { return "failed:$output"; } # Success. $output .= "Linktest run was successful! Stopped at " . date("D M d G:i:s T") . "\n"; return "stopped:$output"; } # See if this request is to one of the above functions. Does not return # if it is. Otherwise return and continue on. sajax_handle_client_request(); # # In plain kill mode, just use the stop_linktest function and then # redirect back to the showexp page. # if (isset($kill) && $kill == 1) { stop_linktest(); header("Location: showexp.php3?pid=$pid&eid=$eid"); return; } # # Okay, this is the initial page. # PAGEHEADER("Run Linktest"); # Must do this! CHECKPAGEARGS(); GRABDBDATA(); echo "\n"; echo "Experiment ". "$pid/". "$eid\n"; echo "

Are you sure you want to run linktest?


\n"; SHOWEXP($pid, $eid, 1); echo "
\n"; echo "
"; echo "\n"; echo "\n"; echo "\n"; echo "
Linktest Option: "; echo "

\n"; if ($linktest_pid) { echo "\n"; } else { echo "\n"; } echo "
\n"; echo "
\n"; echo "
\n"; # # Standard Testbed Footer # PAGEFOOTER(); ?>