= 86400) return sprintf("%0.2f days", $sec/86400); $hrs = intdiv($sec, 3600); $sec %= 3600; $min = intdiv($sec, 60); $sec %= 60; if ($hrs) return sprintf("%2d hr %2d min %2d sec", $hrs, $min, $sec); if ($min) return sprintf("%2d min %2d sec", $min, $sec); return sprintf("%2d sec", $sec); } function MyAndSfxToQrz(string $my, string $sfx) { $my = trim($my); $sfx = trim($sfx); if (0 == strlen($my)) { $my = 'Empty MYCall '; } else { if (strpos($my, ' ')) $link = strstr($my, ' ', true); else $link = $my; if (strlen($sfx)) $my .= '/'.$sfx; $len = strlen($my); $my = ''.$my.''; while ($len < 13) { $my .= ' '; $len += 1; } } return $my; } ParseKVFile($cfgdir.'/qn.cfg', $cfg); ParseKVFile($cfgdir.'/defaults', $defaults); ?>
', "\n";
echo str_replace(' ', ' ', 'USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
'), "\n";
$lines = explode("\n", `ps -aux | grep -e qngateway -e qnlink -e qndtmf -e qndvap -e qnitap -e qnrelay -e qndvrptr -e qnmodem -e MMDVMHost | grep -v grep`);
foreach ($lines as $line) {
echo str_replace(' ', ' ', $line), "
\n";
}
echo '', "\n";
}
if ('true' == GetCFGValue('dash_show_lh')) {
echo 'Last Heard:', "\n";
$rstr = 'MyCall/Sfx Source Last Time
';
echo str_replace(' ', ' ', $rstr), "\n";
$dbname = $cfgdir.'/'.GetCFGValue('dash_sql_filename');
$db = new SQLite3($dbname, SQLITE3_OPEN_READONLY);
$ss = 'SELECT mycall,sfx,urcall,strftime("%s","now")-lasttime FROM LHEARD ORDER BY 4 LIMIT '.GetCFGValue('dash_lastheard_count').' ';
if ($stmnt = $db->prepare($ss)) {
if ($result = $stmnt->execute()) {
while ($row = $result->FetchArray(SQLITE3_NUM)) {
$source = ("CQCQCQ " == $row[2]) ? "Linking" : "Routing";
$rstr = MyAndSfxToQrz($row[0], $row[1]).' '.$source.' '.SecToString(intval($row[3])).'
';
echo str_replace('*', ' ', str_replace(' ', ' ', $rstr)), "\n";
}
$result->finalize();
}
$stmnt->close();
}
$db->Close();
echo '| Internal | IPV4 | IPV6 |
| ', GetIP('internal'), ' | ', GetIP('ipv4'), ' | ', GetIP('ipv6'), ' |
| Module | Modem | Frequency | Repeater | Repeater IP |
| ',strtoupper($mod),' | ',$cfg[$module],' | ',$freq,' | ',$linkstatus,' | ',$stat[3],' |
QnetGateway Dashboard Version 2.0 Copyright © by Thomas A. Early, N7TAE.