google code style
This commit is contained in:
parent
d6b126fe8c
commit
707694d4ea
|
@ -78,13 +78,11 @@ my $sql = $Config{ZM_SERVER_ID} ? 'SELECT * FROM Monitors WHERE ServerId=?' : 'S
|
|||
my $sth = $dbh->prepare_cached( $sql )
|
||||
or Fatal( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
while( 1 ) {
|
||||
my $now = time();
|
||||
my $res = $sth->execute( $Config{ZM_SERVER_ID} ? $Config{ZM_SERVER_ID} : () )
|
||||
or Fatal( "Can't execute: ".$sth->errstr() );
|
||||
while( my $monitor = $sth->fetchrow_hashref() )
|
||||
{
|
||||
while( my $monitor = $sth->fetchrow_hashref() ) {
|
||||
next if $monitor->{Function} eq 'None';
|
||||
my $restart = 0;
|
||||
if ( zmMemVerify( $monitor )
|
||||
|
@ -112,35 +110,26 @@ while( 1 )
|
|||
;
|
||||
my $image_delay = $now-$image_time;
|
||||
Debug( "Monitor $monitor->{Id} last captured $image_delay seconds ago, max is $max_image_delay\n" );
|
||||
if ( $image_delay > $max_image_delay )
|
||||
{
|
||||
if ( $image_delay > $max_image_delay ) {
|
||||
Info( "Restarting capture daemon for "
|
||||
.$monitor->{Name}.", time since last capture $image_delay seconds ($now-$image_time)\n"
|
||||
);
|
||||
$restart = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Info( "Restarting capture daemon for ".$monitor->{Name}.", shared data not valid\n" );
|
||||
$restart = 1;
|
||||
}
|
||||
|
||||
if ( $restart )
|
||||
{
|
||||
if ( $restart ) {
|
||||
my $command;
|
||||
if ( $monitor->{Type} eq 'Local' )
|
||||
{
|
||||
if ( $monitor->{Type} eq 'Local' ) {
|
||||
$command = "zmdc.pl restart zmc -d $monitor->{Device}";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$command = "zmdc.pl restart zmc -m $monitor->{Id}";
|
||||
}
|
||||
runCommand( $command );
|
||||
}
|
||||
elsif ( $monitor->{Function} ne 'Monitor' )
|
||||
{
|
||||
} elsif ( $monitor->{Function} ne 'Monitor' ) {
|
||||
# Now check analysis daemon
|
||||
$restart = 0;
|
||||
# Check we have got an image recently
|
||||
|
@ -163,8 +152,7 @@ while( 1 )
|
|||
;
|
||||
my $image_delay = $now-$image_time;
|
||||
Debug( "Monitor $monitor->{Id} last analysed $image_delay seconds ago, max is $max_image_delay\n" );
|
||||
if ( $image_delay > $max_image_delay )
|
||||
{
|
||||
if ( $image_delay > $max_image_delay ) {
|
||||
Info( "Analysis daemon for $$monitor{id} $$monitor{Name} needs restarting,"
|
||||
." time since last analysis $image_delay seconds ($now-$image_time)\n"
|
||||
);
|
||||
|
@ -172,8 +160,7 @@ while( 1 )
|
|||
}
|
||||
}
|
||||
|
||||
if ( $restart )
|
||||
{
|
||||
if ( $restart ) {
|
||||
Info( "Restarting analysis daemon for $$monitor{id} $$monitor{Name}\n");
|
||||
my $command = "zmdc.pl restart zma -m ".$monitor->{Id};
|
||||
runCommand( $command );
|
||||
|
@ -184,5 +171,8 @@ while( 1 )
|
|||
} # end foreach monitor
|
||||
sleep( $Config{ZM_WATCH_CHECK_INTERVAL} );
|
||||
} # end while (1)
|
||||
|
||||
Info( "Watchdog exiting\n" );
|
||||
exit();
|
||||
1;
|
||||
__END__
|
||||
|
|
Loading…
Reference in New Issue