` on the * device; output streams to /var/log/pi-star/pi-star_icmptest.log * which this page tails via AJAX (jquery-timing $.repeat). * * Uses system()/exec() rather than the staged-write pattern — no * file edits, just a privileged background process. */ require_once($_SERVER['DOCUMENT_ROOT'].'/config/security_headers.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/config/banner_warnings.inc'); setSecurityHeaders(); // Layer 2 of the default-password protection — see config/banner_warnings.inc. // MUST run BEFORE any output so header('Location: ...') works. pistar_warnings_enforce_redirect(); // Load the language support require_once('../config/language.php'); // Load the Pi-Star Release file $pistarReleaseConfig = '/etc/pistar-release'; $configPistarRelease = array(); $configPistarRelease = parse_ini_file($pistarReleaseConfig, true); // Load the Version Info require_once('../config/version.php'); // Sanity Check that this file has been opened correctly if ($_SERVER["PHP_SELF"] == "/admin/expert/jitter_test.php") { if (isset($_GET['group'])) { if ($_GET['group'] == "brandmeister") { $target = "BM"; } if ($_GET['group'] == "dmrplus") { $target = "DMR+"; } if ($_GET['group'] == "hblink") { $target = "HB"; } } else { $target = "DMR+"; } if (!isset($_GET['ajax'])) { // truncate creates+clears the log file in one synchronous call — // see admin/update.php for the full rationale. system('sudo truncate -s 0 /var/log/pi-star/pi-star_icmptest.log'); system('sudo /usr/local/sbin/pistar-jittertest '.$target.' > /dev/null 2>&1 &'); } // Sanity Check Passed. header('Cache-Control: no-cache'); session_start(); if (!isset($_GET['ajax'])) { //unset($_SESSION['update_offset']); if (file_exists('/var/log/pi-star/pi-star_icmptest.log')) { $_SESSION['update_offset'] = filesize('/var/log/pi-star/pi-star_icmptest.log'); } else { $_SESSION['update_offset'] = 0; } } if (isset($_GET['ajax'])) { //session_start(); if (!file_exists('/var/log/pi-star/pi-star_icmptest.log')) { exit(); } $handle = fopen('/var/log/pi-star/pi-star_icmptest.log', 'rb'); if (isset($_SESSION['update_offset'])) { fseek($handle, 0, SEEK_END); if ($_SESSION['update_offset'] > ftell($handle)) //log rotated/truncated $_SESSION['update_offset'] = 0; //continue at beginning of the new log $data = stream_get_contents($handle, -1, $_SESSION['update_offset']); $_SESSION['update_offset'] += strlen($data); echo "
$data
"; } else { fseek($handle, 0, SEEK_END); $_SESSION['update_offset'] = ftell($handle); } exit(); } ?> Pi-Star - <?php echo $lang['digital_voice']." ".$lang['dashboard']." - ".$lang['update'];?>
Test Running
Starting test, please wait...