From 1f8871639a4f52868d15fcd84e7c0ebfa6f882b6 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 27 Jul 2017 09:56:07 -0400 Subject: [PATCH] only complain about losing the dbh connection, if we can't reconnect --- scripts/zmaudit.pl.in | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/zmaudit.pl.in b/scripts/zmaudit.pl.in index 0a111f899..db8ca5933 100644 --- a/scripts/zmaudit.pl.in +++ b/scripts/zmaudit.pl.in @@ -144,15 +144,16 @@ MAIN: while( $loop ) { # After a long sleep, we may need to reconnect to the db while ( ! ( $dbh and $dbh->ping() ) ) { $dbh = zmDbConnect(); - - if ( $continuous ) { - Error('Unable to connect to database'); -# 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 { - Fatal('Unable to connect to database'); + if ( ! $dbh ) { + if ( $continuous ) { + Error('Unable to connect to database'); + # 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 { + Fatal('Unable to connect to database'); + } # end if } # end if } # end while can't connect to the db