Logging and whitespace

This commit is contained in:
Isaac Connor 2018-12-20 13:55:18 -05:00
parent 64bdf40e86
commit 6af8f0d419
1 changed files with 7 additions and 4 deletions

View File

@ -257,6 +257,8 @@ sub run {
}
my $fd = 0;
# This also closes dbh and CLIENT and SERVER
while( $fd < POSIX::sysconf(&POSIX::_SC_OPEN_MAX) ) {
POSIX::close($fd++);
}
@ -300,16 +302,17 @@ sub run {
if ( $Config{ZM_SERVER_ID} ) {
if ( ! ( $secs_count % 60 ) ) {
Debug("Connecting");
while ( (!$zm_terminate) and !($dbh and $dbh->ping()) ) {
Warning("Not connected to db ($dbh)".($dbh?' ping('.$dbh->ping().')':''). ($DBI::errstr?" errstr($DBI::errstr)":'').' Reconnecting');
$dbh = zmDbConnect();
}
last if $zm_terminate;
my @cpuload = CpuLoad();
Debug("Updating Server record @cpuload");
if ( ! defined $dbh->do(q{UPDATE Servers SET Status=?,CpuLoad=?,TotalMem=?,FreeMem=?,TotalSwap=?,FreeSwap=? WHERE Id=?}, undef,
'Running', $cpuload[0], &totalmem, &freemem, &totalswap, &freeswap, $Config{ZM_SERVER_ID} ) ) {
Error("Failed Updating status of Server record for Id=$Config{ZM_SERVER_ID}".$dbh->errstr());
Error("Failed Updating status of Server record for Id=$Config{ZM_SERVER_ID} :".$dbh->errstr());
}
}
$secs_count += 1;
@ -375,7 +378,7 @@ sub run {
} # end while
dPrint(ZoneMinder::Logger::INFO, 'Server exiting at '
.strftime( '%y/%m/%d %H:%M:%S', localtime() )
.strftime('%y/%m/%d %H:%M:%S', localtime())
."\n"
);
if ( $Config{ZM_SERVER_ID} ) {
@ -709,7 +712,7 @@ sub reaper {
$process->{delay} = $Config{ZM_MAX_RESTART_DELAY};
}
}
Debug("Delay for $$process{command} is now $$process{delay}");
#Debug("Delay for $$process{command} is now $$process{delay}");
} else {
delete $cmd_hash{$$process{command}};
}