{$_REQUEST['command']},"; foreach ($_COOKIE['history'] as $h) { echo "$h,"; }; echo "
\n"; //echo "" . isset($_COOKIE['history']) . ',' . array_search($_REQUEST['command'], $_COOKIE['history']) . "
\n"; if (isset($_COOKIE['history']) && array_search($_REQUEST['command'], $_COOKIE['history'])!==FALSE) { // this command is already in the history, so do not need to add it } else { $i = isset($_COOKIE['history']) ? count($_COOKIE['history']) : 0; setcookie("history[$i]", $_REQUEST['command'], $expire_time); } //print_r($_COOKIE); //get the command and the options $cmd = @$_REQUEST["command"]; $copy = @$_REQUEST["copy"]; $node = @$_REQUEST["node"]; $group = @$_REQUEST["nodegrps"]; $psh = @$_REQUEST["psh"]; $serial = @$_REQUEST["serial"]; $verify = @$_REQUEST["verify"]; $collapse = @$_REQUEST["collapse"]; $fanout = @$_REQUEST["fanout"]; $userID = @$_REQUEST["userID"]; $rshell = @$_REQUEST["rshell"]; $shell_opt = @$_REQUEST["shell_opt"]; $monitor = @$_REQUEST["monitor"]; $ret_code = @$_REQUEST["ret_code"]; //if ($group == "") $nodegrps = "blade7"; // For now, use blade7 as test node if ($psh == "off"){ //using dsh $command = "xdsh "; $copy_cmd = "xdcp "; if ($group == "") $node_group = /* "-n " . */ $node; else $node_group = /* "-N " . */ $group; }else{ $command = "psh "; $copy_cmd = "pscp "; if ($group == "") $node_group = $node; else $node_group = $group; } if ($serial == "on") $options = "-s "; //serial mode/streaming mode if ($fanout == "") $options .= "-f 64 "; else $options .= "-f " . $fanout; if ($userID != "") $options .= "-l " . $userID; if ($verify == "on") $options .= "-v "; if ($monitor == "on") $options .= "-m "; //echo "Command: ". $cmd ."
"; //$exp_cmd = "export DSH_CONTEXT=XCAT XCATROOT=/opt/xcat; "; if ($copy == "on"){ //using dcp/prcp //extract the script name from the command $script = strtok($cmd,' '); //copy the command to the remote node $source = "/opt/xcat/bin/" . $script; //copy from $target = "/tmp"; //copy to if ($psh == "off"){ $copy_cmd = $exp_cmd . $copy_cmd . $node_group . " " . $source . " " . $target; }else{ $copy_cmd = $copy_cmd . $source . " " . $node_group . ":" . $target; } runcmd($copy_cmd,1, $outp); if ($psh != "on"){ $command_string = $exp_cmd . $command. $node_group . " /tmp/" . $cmd; }else{ $command_string = $command . $node_group . " /tmp/" . $cmd; } } else{ if ($psh != "on"){ $command_string = $exp_cmd . $command. $node_group . " " . $cmd; }else{ $command_string = $command . $node_group . " " . $cmd; } } if ($collapse == "on") $command_string .= " | dshbak -c"; echo "Command: $command_string
"; //echo "Command Ouput:
"; //output will be returned from the runcmd function call //run the script $output = array(); if ($ret_code == "on"){ $rc = runcmd($command_string, 0, $output); //mode 0 if ($rc == 0){ foreach ($output as $line){ echo "$line