This is my suggestion, unless there are error conditions for which mysqldump does not return 0. We probably always want to see the output from mysqldump (and we did before). We should also not return and not fall trhough to unlinking the output files. And "verbose empty" output and 0 exit status is probably not useful. Perhaps would want to post the output at WARNING level.
Code:
if( $r > 0 ) {
&printLog("Command exit status is : $r \n" );
&printCommandOutputToLog( "ERROR", "command is : $command", $CMDERR );
&printCommandOutputToLog( "ERROR", "pipe exit status", $pipestatus );
&printAndDie("mysqldump did not succeed.\n");
}elsif ( -s $CMDERR ) {
&printCommandOutputToLog( "INFO", "mysqldump output for command : $command", $CMDERR );
}
unlink($CMDERR);
unlink($pipestatus);
Code:
diff -up MySQL-zrm-3.0/usr/bin/mysql-zrm-backup.output MySQL-zrm-3.0/usr/bin/mysql-zrm-backup
--- MySQL-zrm-3.0/usr/bin/mysql-zrm-backup.output 2014-04-03 17:02:13.648882414 -0600
+++ MySQL-zrm-3.0/usr/bin/mysql-zrm-backup 2014-04-23 15:54:57.878992944 -0600
@@ -1833,51 +1833,18 @@ sub doMySqlDump()
if( $abort_flag ){
&abortAndDie( );
}
- if(( $r > 0 ) || (-s $CMDERR)) {
+ if( $r > 0 ) {
&printLog("Command exit status is : $r \n" );
- if( $r eq 0 && -s $CMDERR){
- if(&checkCmdWarning($CMDERR)){
- &printCommandOutputToLog( "INFO", "mysqldump output for command : $command", $CMDERR );
- return;
- }
- }
&printCommandOutputToLog( "ERROR", "command is : $command", $CMDERR );
&printCommandOutputToLog( "ERROR", "pipe exit status", $pipestatus );
&printAndDie("mysqldump did not succeed.\n");
- }else {
- if( $verbose ) {
- &printCommandOutputToLog( "INFO", "mysqldump output for command : $command", $CMDERR );
- &printCommandOutputToLog( "INFO", "mysqldump output for command : $command", $pipestatus );
- }
+ }elsif ( -s $CMDERR ) {
+ &printCommandOutputToLog( "INFO", "mysqldump output for command : $command", $CMDERR );
}
unlink($CMDERR);
unlink($pipestatus);
}
-sub checkCmdWarning()
-{
- my $CMDERR = $_[0];
- if(-s $CMDERR) {
- unless(open(CMD_ERR, $CMDERR)) {
- &printLog( "Could not open $CMDERR for reading ,$!\n" );
- return(0);
- }
- my $found = 0;
- while (<CMD_ERR>) {
- my $err_output = $_;
- chomp($err_output);
- if($err_output =~ /Using a password on the command line interface can be insecure/i) {
- $found = 1;
- last;
- }
- }
- if($found){
- return 1;
- }
- }
- return 0;
-}
-
sub checkAndBackupReplicationData()
{
if( !$inputs{replication} || $inputs{replication} eq "0" ) {