Modes get red if corresponding process on host is not running, output of \'not linked\' if ircddbgateway is starting up or message if ircddbgateway is not running but D-Star is switched on in MMDVM.ini
This commit is contained in:
parent
0af9a21df3
commit
4ac7486324
2 changed files with 39 additions and 4 deletions
|
@ -71,6 +71,9 @@ switch (DISTRIBUTION) {
|
||||||
define("CONFIGFILENAME", "ircddbgateway");
|
define("CONFIGFILENAME", "ircddbgateway");
|
||||||
define("GATEWAYCONFIGPATH", CONFIGPATH . "/" . CONFIGFILENAME);
|
define("GATEWAYCONFIGPATH", CONFIGPATH . "/" . CONFIGFILENAME);
|
||||||
|
|
||||||
|
// set to called ircddbgateway-programm like ircddbgatewayd or ircddbgateway
|
||||||
|
define("IRCDDBGATEWAY", "ircddbgatewayd");
|
||||||
|
|
||||||
// set time to refresh page
|
// set time to refresh page
|
||||||
define("REFRESHAFTER", "60");
|
define("REFRESHAFTER", "60");
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,17 @@ function getMMDVMHostVersion() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isProcessRunning($processname) {
|
||||||
|
exec("pgrep " . $processname, $pids);
|
||||||
|
if(empty($pids)) {
|
||||||
|
// process not running!
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// process running!
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getMMDVMConfig() {
|
function getMMDVMConfig() {
|
||||||
// loads MMDVM.ini into array for further use
|
// loads MMDVM.ini into array for further use
|
||||||
$mmdvmconfigs = array();
|
$mmdvmconfigs = array();
|
||||||
|
@ -49,7 +60,21 @@ function showMode($mode, $mmdvmconfigs) {
|
||||||
?>
|
?>
|
||||||
<td><span class="label <?php
|
<td><span class="label <?php
|
||||||
if (getEnabled($mode, $mmdvmconfigs) == 1) {
|
if (getEnabled($mode, $mmdvmconfigs) == 1) {
|
||||||
|
if ($mode == "D-Star" || $mode == "D-Star Network") {
|
||||||
|
if (isProcessRunning(IRCDDBGATEWAY)) {
|
||||||
echo "label-success";
|
echo "label-success";
|
||||||
|
} else {
|
||||||
|
echo "label-danger";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($mode =="DMR" || $mode =="DMR Network" || $mode =="System Fusion" || $mode =="System Fusion Network") {
|
||||||
|
if (isProcessRunning("MMDVMHost")) {
|
||||||
|
echo "label-success";
|
||||||
|
} else {
|
||||||
|
echo "label-danger";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "label-default";
|
echo "label-default";
|
||||||
}
|
}
|
||||||
|
@ -236,6 +261,9 @@ function getActualMode($logLines, $mmdvmconfigs) {
|
||||||
|
|
||||||
function getDSTARLinks() {
|
function getDSTARLinks() {
|
||||||
// returns link-states of all D-Star-modules
|
// returns link-states of all D-Star-modules
|
||||||
|
if (filesize(LINKLOGPATH) == 0) {
|
||||||
|
return "not linked";
|
||||||
|
}
|
||||||
$out = "<table>";
|
$out = "<table>";
|
||||||
if ($linkLog = fopen(LINKLOGPATH,'r')) {
|
if ($linkLog = fopen(LINKLOGPATH,'r')) {
|
||||||
while ($linkLine = fgets($linkLog)) {
|
while ($linkLine = fgets($linkLog)) {
|
||||||
|
@ -293,7 +321,11 @@ function getActualLink($logLines, $mode) {
|
||||||
array_multisort($logLines,SORT_DESC);
|
array_multisort($logLines,SORT_DESC);
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case "D-Star":
|
case "D-Star":
|
||||||
|
if (isProcessRunning(IRCDDBGATEWAY)) {
|
||||||
return getDSTARLinks();
|
return getDSTARLinks();
|
||||||
|
} else {
|
||||||
|
return "ircddbgateway not running!";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "DMR Slot 1":
|
case "DMR Slot 1":
|
||||||
foreach ($logLines as $logLine) {
|
foreach ($logLines as $logLine) {
|
||||||
|
|
Loading…
Reference in a new issue