[mylvmbackup] script doesn't die on db connect failure
- From: "Boehm, Matthew" <mboehm@xxxxxxxxxxxxx>
- To: <mylvmbackup@xxxxxxxxxxxxx>
- Date: Thu, 9 Oct 2008 17:10:15 -0500
All,
Just noticed this. If I turn off MySQL and attempt to run the script,
the "preflush" script will actually run.
Consider this code from mylvmbackup.pl:192
my $dbh= DBI->connect($dsn,$user,$password)
or log_msg ($DBI::errstr, LOG_ERR) && die $DBI::errstr;
On DBI->connect() failure, the log_msg() runs, but the die() does not.
Code execution continues on to the next line which is
run_hook("preflush");
Proposed fix. Verified correct behavior.
my $dbh = DBI->connect($dsn,$user,$password);
if(!$dbh)
{
log_msg ($DBI::errstr, LOG_ERR);
die($DBI::errstr);
}
Cheers,
Matthew
Matthew Boehm
Senior MySQL DBA, The Planet - Northstar Managed Hosting
Certified MySQL 5.0 DBA
Certified MySQL 5.1 Cluster DBA
Office: 281-714-4018
Mobile: 832-253-8258
Email: mboehm@xxxxxxxxxxxxx
- Follow-Ups:
- [mylvmbackup] Re: script doesn't die on db connect failure
- From: Lenz Grimmer
Other related posts:
- » [mylvmbackup] script doesn't die on db connect failure
- » [mylvmbackup] Re: script doesn't die on db connect failure
- [mylvmbackup] Re: script doesn't die on db connect failure
- From: Lenz Grimmer