function runJob($job)
{
    global $debug, $sendLogToEmail, $resultsSummary, $jobdir;
    $resultsSummary = "";
    $lastActual = $job["lastActual"];
    $lastScheduled = $job["lastScheduled"];
    if ($lastScheduled > $lastActual) {
        logMessage("Running\t" . $job[PC_CRONLINE]);
        logMessage("  Last run:\t" . date("r", $lastActual));
        logMessage("  Last scheduled:\t" . date("r", $lastScheduled));
        $argv = $job[PC_ARGS];
        $jobData = getJobTempData($job);
        $benchmark = job_benchmark_start();
        ob_start();
        include CRON_PATH . $job[PC_CMD];
        $return = trim(ob_get_contents());
        ob_end_clean();
        $seconds = job_benchmark_end($benchmark);
        if ($debug) {
            echo $return;
        }
        if (!empty($return)) {
            logMessage("  Script returned:\t" . makeOneLine($return));
        }
        logMessage("  Execution time:\t{$seconds} seconds");
        markLastRun($job, $lastScheduled, $jobData);
        logMessage("Completed\t" . $job[PC_CRONLINE]);
        if ($sendLogToEmail != "") {
            mail($sendLogToEmail, "[cron] " . $job[PC_COMMENT], $resultsSummary);
        }
        return true;
    } else {
        if ($debug) {
            logMessage("Skipping\t" . $job[PC_CRONLINE]);
            logMessage("  Last run:\t" . date("r", $lastActual));
            logMessage("  Last scheduled:\t" . date("r", $lastScheduled));
            logMessage("Completed\t" . $job[PC_CRONLINE]);
        }
        return false;
    }
}
function runJob($job)
{
    global $debug, $sendLogToEmail, $resultsSummary, $jobdir;
    $resultsSummary = "";
    $lastActual = $job["lastActual"];
    $lastScheduled = $job["lastScheduled"];
    if ($lastScheduled > $lastActual) {
        logMessage("Running\t" . $job[PC_CRONLINE]);
        logMessage("  Last run:\t" . date("r", $lastActual));
        logMessage("  Last scheduled:\t" . date("r", $lastScheduled));
        $argv = $job[PC_ARGS];
        $jobData = getJobTempData($job);
        $benchmark = job_benchmark_start();
        if ($debug) {
            include CRON_PATH . $job[PC_CMD];
        } else {
            $e = @error_reporting(0);
            include CRON_PATH . $job[PC_CMD];
            @error_reporting($e);
        }
        $seconds = job_benchmark_end($benchmark);
        logMessage("  Execution time:\t{$seconds} seconds");
        markLastRun($job, $lastScheduled, $jobData);
        logMessage("Completed\t" . $job[PC_CRONLINE]);
        if ($sendLogToEmail != "") {
            mail($sendLogToEmail, "[cron] " . $job[PC_COMMENT], $resultsSummary);
        }
        return true;
    } else {
        if ($debug) {
            logMessage("Skipping\t" . $job[PC_CRONLINE]);
            logMessage("  Last run:\t" . date("r", $lastActual));
            logMessage("  Last scheduled:\t" . date("r", $lastScheduled));
            logMessage("Completed\t" . $job[PC_CRONLINE]);
        }
        return false;
    }
}