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:
stan 2005-10-01 16:13:48 +00:00
parent dbd6926c78
commit fc1cc633cd
2 changed files with 49 additions and 4 deletions

View File

@ -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 )
{
$string = ZM_PATH_BIN."/zmdc.pl check";

View File

@ -58,8 +58,8 @@ while( $row = mysql_fetch_assoc( $result ) )
{
continue;
}
$row['zmc'] = zmcCheck( $row );
$row['zma'] = zmaCheck( $row );
$row['zmc'] = zmcStatus( $row );
$row['zma'] = zmaStatus( $row );
$sql = "select count(Id) as ZoneCount from Zones where MonitorId = '".$row['Id']."'";
$result2 = mysql_query( $sql );
if ( !$result2 )
@ -110,11 +110,11 @@ window.resizeTo( <?= $jws['console']['w'] ?>, <?= $jws['console']['h']+(25*(coun
?>
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)
{
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)
{