Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-camogm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-camogm
Commits
ebaeff33
Commit
ebaeff33
authored
Nov 17, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd=status will not hang
parent
c152627e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
10 deletions
+32
-10
camogm_interface.php
src/camogmgui/camogm_interface.php
+32
-10
No files found.
src/camogmgui/camogm_interface.php
View file @
ebaeff33
...
@@ -129,17 +129,39 @@ if ($cmd == "run_camogm")
...
@@ -129,17 +129,39 @@ if ($cmd == "run_camogm")
}
}
else
if
(
$cmd
==
"status"
)
else
if
(
$cmd
==
"status"
)
{
{
$pipe
=
"/var/state/camogm.state"
;
// is camogm running
$mode
=
0777
;
$camogm_running
=
"not running"
;
if
(
!
file_exists
(
$pipe
))
{
umask
(
0
);
exec
(
'ps | grep "camogm"'
,
$arr
);
posix_mkfifo
(
$pipe
,
$mode
);
function
low_daemon
(
$v
)
{
return
(
substr
(
$v
,
-
1
)
!=
']'
);
}
}
$fcmd
=
fopen
(
$cmd_pipe
,
"w"
);
fprintf
(
$fcmd
,
"xstatus=%s
\n
"
,
$pipe
);
$p
=
(
array_filter
(
$arr
,
"low_daemon"
));
fclose
(
$fcmd
);
$check
=
implode
(
"<br />"
,
$p
);
$status
=
file_get_contents
(
$pipe
);
if
(
strstr
(
$check
,
$start_str
))
$camogm_running
=
"on"
;
else
$camogm_running
=
"off"
;
if
(
$camogm_running
==
"on"
){
$pipe
=
"/var/state/camogm.state"
;
$mode
=
0777
;
if
(
!
file_exists
(
$pipe
))
{
umask
(
0
);
posix_mkfifo
(
$pipe
,
$mode
);
}
$fcmd
=
fopen
(
$cmd_pipe
,
"w"
);
fprintf
(
$fcmd
,
"xstatus=%s
\n
"
,
$pipe
);
fclose
(
$fcmd
);
$status
=
file_get_contents
(
$pipe
);
}
else
{
$status
=
"<?xml version='1.0'?><camogm_state>
\n
<state>"
.
$camogm_running
.
"</state>
\n
</camogm_state>"
;
}
header
(
"Content-Type: text/xml"
);
header
(
"Content-Type: text/xml"
);
header
(
"Content-Length: "
.
strlen
(
$status
)
.
"
\n
"
);
header
(
"Content-Length: "
.
strlen
(
$status
)
.
"
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment