Example #1
0
function twoPairs()
{
    execScript("twoPairs");
}
Example #2
0
if ($DEBUG) {
    jsonDebug("PROBE-CONF", $probeConf);
}
try {
    $start = durationStart();
    $execTime = time() * 1000;
    $res = array('probe' => $probeID, 'time' => $execTime, 'duration' => -1, 'result' => array());
    // SCRIPT
    if (isset($probeConf['SCRIPT'])) {
        $script = $probeConf['SCRIPT'];
        $cmd = getScriptCmd($script);
        if ($DEBUG) {
            jsonDebug("SCRIPT-COMMAND", $cmd);
        }
        $rc = -1;
        $output = execScript($script, $rc);
        $res['result'][] = array($cmd, $rc, $output);
        $res['duration'] = durationStop($start);
        echo json_encode($res);
    } elseif (isset($probeConf['CMD'])) {
        $cmds = expandCommand($probeConf['CMD']);
        if ($DEBUG) {
            jsonDebug("EXPANDED COMMAND", $cmds);
        }
        foreach ($cmds as $cmd) {
            $rc = -1;
            $output = execCommand($cmd, $rc);
            $res['result'][] = array($cmd, $rc, $output);
        }
        $res['duration'] = durationStop($start);
        echo json_encode($res);