Commit 19ab4811 authored by Mikhail Karpenko's avatar Mikhail Karpenko

camogmgui can be started now

parent ce755ffb
...@@ -70,6 +70,9 @@ ...@@ -70,6 +70,9 @@
$cmd = $_GET['cmd']; $cmd = $_GET['cmd'];
$debug = $_GET['debug']; $debug = $_GET['debug'];
$debuglev = $_GET['debuglev']; $debuglev = $_GET['debuglev'];
$cmd_pipe = "/var/state/camogm_cmd";
$cmd_port = "3456";
$start_str = "camogm -n " . $cmd_pipe . " -p " . $cmd_port;
if ($cmd == "run_camogm") if ($cmd == "run_camogm")
{ {
...@@ -83,7 +86,7 @@ if ($cmd == "run_camogm") ...@@ -83,7 +86,7 @@ if ($cmd == "run_camogm")
$p = (array_filter($arr, "low_daemon")); $p = (array_filter($arr, "low_daemon"));
$check = implode("<br />",$p); $check = implode("<br />",$p);
if (strstr($check, "camogm /var/state/camogm_cmd")) if (strstr($check, $start_str))
$camogm_running = true; $camogm_running = true;
else else
$camogm_running = false; $camogm_running = false;
...@@ -91,8 +94,8 @@ if ($cmd == "run_camogm") ...@@ -91,8 +94,8 @@ if ($cmd == "run_camogm")
exec("rm /var/state/camogm.state"); exec("rm /var/state/camogm.state");
if (!$debug) exec('camogm /var/state/camogm_cmd > /dev/null 2>&1 &'); // "> /dev/null 2>&1 &" makes sure it is really really run as a background job that does not wait for input if (!$debug) exec($start_str.' > /dev/null 2>&1 &'); // "> /dev/null 2>&1 &" makes sure it is really really run as a background job that does not wait for input
else exec('camogm /var/state/camogm_cmd > '.$debug.' 2>&1 &'); else exec($start_str.$debug.' 2>&1 &');
for($i=0;$i<5;$i++) { for($i=0;$i<5;$i++) {
if (is_file("/var/state/camogm.state")) break; if (is_file("/var/state/camogm.state")) break;
...@@ -100,7 +103,7 @@ if ($cmd == "run_camogm") ...@@ -100,7 +103,7 @@ if ($cmd == "run_camogm")
} }
if ($debug) { if ($debug) {
$cmd_pipe = "/var/state/camogm_cmd"; // $cmd_pipe = "/var/state/camogm_cmd";
$fcmd = fopen($cmd_pipe, "w"); $fcmd = fopen($cmd_pipe, "w");
fprintf($fcmd,"debuglev=$debuglev"); fprintf($fcmd,"debuglev=$debuglev");
} }
...@@ -109,7 +112,7 @@ if ($cmd == "run_camogm") ...@@ -109,7 +112,7 @@ if ($cmd == "run_camogm")
else if ($cmd == "status") else if ($cmd == "status")
{ {
$pipe="/var/state/camogm.state"; $pipe="/var/state/camogm.state";
$cmd_pipe="/var/state/camogm_cmd"; // $cmd_pipe="/var/state/camogm_cmd";
$mode=0777; $mode=0777;
if(!file_exists($pipe)) { if(!file_exists($pipe)) {
umask(0); umask(0);
...@@ -139,7 +142,7 @@ else if ($cmd == "run_status") ...@@ -139,7 +142,7 @@ else if ($cmd == "run_status")
$p = (array_filter($arr, "low_daemon")); $p = (array_filter($arr, "low_daemon"));
$check = implode("<br />",$p); $check = implode("<br />",$p);
if (strstr($check, "camogm /var/state/camogm_cmd")) if (strstr($check, $start_str))
$camogm_running = "on"; $camogm_running = "on";
else else
$camogm_running = "off"; $camogm_running = "off";
...@@ -290,7 +293,7 @@ else if ($cmd=="list") { ...@@ -290,7 +293,7 @@ else if ($cmd=="list") {
else else
{ {
$cmd_pipe = "/var/state/camogm_cmd"; // $cmd_pipe = "/var/state/camogm_cmd";
$fcmd = fopen($cmd_pipe, "w"); $fcmd = fopen($cmd_pipe, "w");
xml_header(); xml_header();
......
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
$pipe = "/var/state/camogm.state"; $pipe = "/var/state/camogm.state";
$cmd_pipe = "/var/state/camogm_cmd"; $cmd_pipe = "/var/state/camogm_cmd";
$cmd_port = "3456";
$start_str = "camogm -n " . $cmd_pipe . " -p " . $cmd_port;
$mode = 0777; $mode = 0777;
if(!file_exists($pipe)) { if(!file_exists($pipe)) {
...@@ -78,7 +80,7 @@ ...@@ -78,7 +80,7 @@
$p = (array_filter($arr, "low_daemon")); $p = (array_filter($arr, "low_daemon"));
$check = implode("<br />",$p); $check = implode("<br />",$p);
if (strstr($check, "camogm /var/state/camogm_cmd")) if (strstr($check, $start_str))
$camogm_running = true; $camogm_running = true;
else else
$camogm_running = false; $camogm_running = false;
......
...@@ -39,7 +39,7 @@ class xml_simple { ...@@ -39,7 +39,7 @@ class xml_simple {
// Create the XML parser that will read XML data formatted with the specified encoding // Create the XML parser that will read XML data formatted with the specified encoding
function xml_simple($encoding = 'UTF-8') { function xml_simple($encoding = 'UTF-8') {
$this->parser = xml_parser_create($encoding); $this->parser = xml_parser_create($encoding);
xml_set_object($this->parser, &$this); xml_set_object($this->parser, $this);
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1); xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, 'UTF-8'); xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment