diff --git a/web/zm.php b/web/zm.php index 1691555d4..ba492f0c0 100644 --- a/web/zm.php +++ b/web/zm.php @@ -125,15 +125,29 @@ if ( $action ) $ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zmc $did' | grep -v grep" ) ); if ( $ps_array[3] ) { - $zmc = $ps_array[3]; - exec( "kill -TERM $zmc" ); + $zmc_pid = $ps_array[3]; + exec( "kill -TERM $zmc_pid" ); + } + while( $zmc_pid ) + { + sleep( 1 ); + $ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zmc $did' | grep -v grep" ) ); + $zmc_pid = $ps_array[3]; } } elseif ( !$zmc_status && $zmc_action ) { # Start Capture daemon - $command = "/usr/local/bin/zmc $did &"; + $command = '/usr/local/bin/zmc '.$did.' 2>/dev/null >&- <&- >/dev/null &'; exec( $command ); + $ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zmc $did' | grep -v grep" ) ); + $zmc_pid = $ps_array[3]; + while ( !$zmc_pid ) + { + sleep( 1 ); + $ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zmc $did' | grep -v grep" ) ); + $zmc_pid = $ps_array[3]; + } } if ( $zma_status && !$zma_action ) { @@ -141,17 +155,30 @@ if ( $action ) $ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zma $did' | grep -v grep" ) ); if ( $ps_array[3] ) { - $zma = $ps_array[3]; - exec( "kill -TERM $zma" ); + $zma_pid = $ps_array[3]; + exec( "kill -TERM $zma_pid" ); + } + while( $zma_pid ) + { + sleep( 1 ); + $ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zma $did' | grep -v grep" ) ); + $zma_pid = $ps_array[3]; } } elseif ( !$zma_status && $zma_action ) { # Start Analysis daemon - $command = "/usr/local/bin/zma $did &"; + $command = '/usr/local/bin/zma '.$did.' 2>/dev/null >&- <&- >/dev/null &'; exec( $command ); + $ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zma $did' | grep -v grep" ) ); + $zma_pid = $ps_array[3]; + while ( !$zma_pid ) + { + sleep( 1 ); + $ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zma $did' | grep -v grep" ) ); + $zma_pid = $ps_array[3]; + } } - sleep( 3 ); } } @@ -162,7 +189,7 @@ if ( !$view ) if ( $view == "console" ) { - header("Refresh: ".REFRESH_MAIN."; URL='index.php" ); + header("Refresh: ".REFRESH_MAIN."; URL='$PHP_SELF'" ); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 @@ -227,14 +254,14 @@ function newWindow(Url,Name,Width,Height) { Monitors Currently configured for bandwidth (change to - high - medium - low ) -Monitor All + high + medium + low ) +Monitor All - + @@ -271,10 +298,10 @@ function newWindow(Url,Name,Width,Height) { $zone_count += $monitor[ZoneCount]; ?> - - - - + + + + @@ -282,7 +309,7 @@ function newWindow(Url,Name,Width,Height) { - +

- + - - - + + + - + - + @@ -454,7 +481,7 @@ elseif ( $view == "status" ) $status_string = "Alert"; $class = "oratext"; } - header("Refresh: ".REFRESH_STATUS."; URL='index.php?view=status&mid=$mid&last_status=$status'" ); + header("Refresh: ".REFRESH_STATUS."; URL='$PHP_SELF?view=status&mid=$mid&last_status=$status'" ); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 @@ -488,11 +515,11 @@ elseif ( $view == "events" ) { if ( $max_events ) { - header("Refresh: ".REFRESH_EVENTS."; URL='index.php?view=events&mid=$mid&max_events=$max_events'" ); + header("Refresh: ".REFRESH_EVENTS."; URL='$PHP_SELF?view=events&mid=$mid&max_events=$max_events'" ); } else { - header("Refresh: ".REFRESH_EVENTS_ALL."; URL='index.php?view=events&mid=$mid'" ); + header("Refresh: ".REFRESH_EVENTS_ALL."; URL='$PHP_SELF?view=events&mid=$mid'" ); } header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified @@ -520,7 +547,7 @@ function checkAll(form,name){ - + @@ -549,13 +576,13 @@ function checkAll(form,name){ - + - + - + @@ -575,8 +602,8 @@ function checkAll(form,name){ { ?> - - + + @@ -667,7 +694,7 @@ function closeWindow() { } } ?> - +"; + opener.location.href = "?view=delete&eid="; window.close(); } @@ -739,19 +766,19 @@ function deleteImage() { 1 ) { ?> - + 1 ) { ?> - + - + - + @@ -790,7 +817,7 @@ function newWindow(Url,Name,Width,Height) {
Id
.">/dev/video ().">/dev/video () xx
Stream StillsStills StreamStream Close
Last events RecentRecent AllAll ArchiveArchive Check All
()<?php echo $frame_id ?>/<?php echo $row[Score] ?><?php echo $frame_id ?>/<?php echo $row[Score] ?>
FirstFirst   PrevPrev   NextNext   LastLast  
- - - - + + + + -" href="index.php?view=zone&zid="> +" href="?view=zone&zid="> @@ -865,7 +892,7 @@ elseif( $view == "zones" )
- + @@ -799,10 +826,10 @@ function newWindow(Url,Name,Width,Height) {
RefreshDeleteArchiveImagesVideoDeleteArchiveImagesVideo Close
- + @@ -881,8 +908,8 @@ elseif( $view == "zones" ) { ?> - - + + @@ -978,6 +1005,14 @@ elseif ( $view == "device" ) ZM - Device - /dev/video<?php echo $did ?> -
.. ,-,
- + @@ -1051,7 +1082,7 @@ function closeWindow() { - +
Device Daemon Status
Monitor '' Function