Faster method of getting daemon statuses.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1492 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
dbd6926c78
commit
fc1cc633cd
|
@ -559,6 +559,51 @@ function zmaControl( $monitor, $restart=false )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initDaemonStatus()
|
||||||
|
{
|
||||||
|
global $daemon_status;
|
||||||
|
|
||||||
|
if ( !$daemon_status )
|
||||||
|
{
|
||||||
|
$string = ZM_PATH_BIN."/zmdc.pl status";
|
||||||
|
$daemon_status = shell_exec( $string );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function daemonStatus( $daemon, $args=false )
|
||||||
|
{
|
||||||
|
global $daemon_status;
|
||||||
|
|
||||||
|
initDaemonStatus();
|
||||||
|
|
||||||
|
$string .= "$daemon";
|
||||||
|
if ( $args )
|
||||||
|
$string .= " $args";
|
||||||
|
return( strpos( $daemon_status, "'$string' running" ) !== false );
|
||||||
|
}
|
||||||
|
|
||||||
|
function zmcStatus( $monitor )
|
||||||
|
{
|
||||||
|
if ( $monitor['Type'] == 'Local' )
|
||||||
|
{
|
||||||
|
$zmc_args = "-d ".$monitor['Device'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$zmc_args = "-m ".$monitor['Id'];
|
||||||
|
}
|
||||||
|
return( daemonStatus( "zmc", $zmc_args ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
function zmaStatus( $monitor )
|
||||||
|
{
|
||||||
|
if ( is_array( $monitor ) )
|
||||||
|
{
|
||||||
|
$monitor = $monitor['Id'];
|
||||||
|
}
|
||||||
|
return( daemonStatus( "zma", "-m $monitor" ) );
|
||||||
|
}
|
||||||
|
|
||||||
function daemonCheck( $daemon=false, $args=false )
|
function daemonCheck( $daemon=false, $args=false )
|
||||||
{
|
{
|
||||||
$string = ZM_PATH_BIN."/zmdc.pl check";
|
$string = ZM_PATH_BIN."/zmdc.pl check";
|
||||||
|
|
|
@ -58,8 +58,8 @@ while( $row = mysql_fetch_assoc( $result ) )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$row['zmc'] = zmcCheck( $row );
|
$row['zmc'] = zmcStatus( $row );
|
||||||
$row['zma'] = zmaCheck( $row );
|
$row['zma'] = zmaStatus( $row );
|
||||||
$sql = "select count(Id) as ZoneCount from Zones where MonitorId = '".$row['Id']."'";
|
$sql = "select count(Id) as ZoneCount from Zones where MonitorId = '".$row['Id']."'";
|
||||||
$result2 = mysql_query( $sql );
|
$result2 = mysql_query( $sql );
|
||||||
if ( !$result2 )
|
if ( !$result2 )
|
||||||
|
@ -110,11 +110,11 @@ window.resizeTo( <?= $jws['console']['w'] ?>, <?= $jws['console']['h']+(25*(coun
|
||||||
?>
|
?>
|
||||||
function newWindow(Url,Name,Width,Height)
|
function newWindow(Url,Name,Width,Height)
|
||||||
{
|
{
|
||||||
var Name = window.open(Url,Name,"resizable,width="+Width+",height="+Height);
|
var Win = window.open(Url,Name,"resizable,width="+Width+",height="+Height);
|
||||||
}
|
}
|
||||||
function scrollWindow(Url,Name,Width,Height)
|
function scrollWindow(Url,Name,Width,Height)
|
||||||
{
|
{
|
||||||
var Name = window.open(Url,Name,"resizable,scrollbars,width="+Width+",height="+Height);
|
var Win = window.open(Url,Name,"resizable,scrollbars,width="+Width+",height="+Height);
|
||||||
}
|
}
|
||||||
function configureButton(form,name)
|
function configureButton(form,name)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue