add a check for db connection to handle the db going away and coming back
This commit is contained in:
parent
7dbad45e30
commit
9eb88d3f15
|
@ -111,8 +111,19 @@ my $swap_image_path = $Config{ZM_PATH_SWAP};
|
|||
|
||||
my $loop = 1;
|
||||
my $cleaned = 0;
|
||||
MAIN: while( $loop )
|
||||
{
|
||||
MAIN: while( $loop ) {
|
||||
while ( ! ( $dbh and $dbh->ping() ) ) {
|
||||
$dbh = zmDbConnect();
|
||||
|
||||
last if $dbh;
|
||||
if ( $continuous ) {
|
||||
# if we are running continuously, then just skip to the next interval, otherwise we are a one off run, so wait a second and retry until someone kills us.
|
||||
sleep( $Config{ZM_AUDIT_CHECK_INTERVAL} );
|
||||
} else {
|
||||
sleep 1;
|
||||
} # end if
|
||||
} # end while can't connect to the db
|
||||
|
||||
my $db_monitors;
|
||||
my $monitorSelectSql = "select Id from Monitors order by Id";
|
||||
my $monitorSelectSth = $dbh->prepare_cached( $monitorSelectSql ) or Fatal( "Can't prepare '$monitorSelectSql': ".$dbh->errstr() );
|
||||
|
|
Loading…
Reference in New Issue