From f1e314125d0eac50c98a37420c3fdee56d3aecf2 Mon Sep 17 00:00:00 2001 From: mikec Date: Mon, 8 Sep 2008 18:52:59 +0000 Subject: [PATCH] Fixed bug that on systems where mysql root user has a password the mysqldump would not work Fixed bug that on systems that do not use rc.local the backup of the other conf files would fail git-svn-id: svn://192.168.202.10@947 3d104415-ff17-0410-8863-d5cf3c621b8a --- bin/ADMIN_backup.pl | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/bin/ADMIN_backup.pl b/bin/ADMIN_backup.pl index b7d2ae7d..4266ca34 100644 --- a/bin/ADMIN_backup.pl +++ b/bin/ADMIN_backup.pl @@ -271,8 +271,8 @@ if ( ($without_db < 1) && ($conf_only < 1) ) } $sthA->finish(); - $dump_non_log_command = "$mysqldumpbin --lock-tables --flush-logs $VARDB_database $archive_tables | $gzipbin > $ARCHIVEpath/temp/$VARserver_ip$VARDB_database$wday.gz"; - $dump_log_command = "$mysqldumpbin --lock-tables --flush-logs --no-data --no-create-db $VARDB_database $log_tables | $gzipbin > $ARCHIVEpath/temp/LOGS_$VARserver_ip$VARDB_database$wday.gz"; + $dump_non_log_command = "$mysqldumpbin --user=$VARDB_user --password=$VARDB_pass --lock-tables --flush-logs $VARDB_database $archive_tables | $gzipbin > $ARCHIVEpath/temp/$VARserver_ip$VARDB_database$wday.gz"; + $dump_log_command = "$mysqldumpbin --user=$VARDB_user --password=$VARDB_pass --lock-tables --flush-logs --no-data --no-create-db $VARDB_database $log_tables | $gzipbin > $ARCHIVEpath/temp/LOGS_$VARserver_ip$VARDB_database$wday.gz"; if ($DBX) {print "$dump_non_log_command\n$dump_log_command";} `$dump_non_log_command`; @@ -280,7 +280,7 @@ if ( ($without_db < 1) && ($conf_only < 1) ) } else { - `$mysqldumpbin --lock-tables --flush-logs $VARDB_database | $gzipbin > $ARCHIVEpath/temp/$VARserver_ip$VARDB_database$wday.gz`; + `$mysqldumpbin --user=$VARDB_user --password=$VARDB_pass --lock-tables --flush-logs $VARDB_database | $gzipbin > $ARCHIVEpath/temp/$VARserver_ip$VARDB_database$wday.gz`; } } @@ -308,12 +308,23 @@ if ( ($without_conf < 1) && ($db_only < 1) ) if ($without_db < 1) { ### BACKUP OTHER CONF FILES ON THE SERVER ### - `$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$linux$wday$tar /etc/my.cnf /etc/hosts /etc/rc.d/rc.local /etc/resolv.conf`; + $files = ""; + if ( -e ('/etc/my.cnf')) {$files .= "/etc/my.cnf ";} + if ( -e ('/etc/hosts')) {$files .= "/etc/hosts ";} + if ( -e ('/etc/rc.d/rc.local')) {$files .= "/etc/rc.d/rc.local ";} + if ( -e ('/etc/resolv.conf')) {$files .= "/etc/resolv.conf ";} + + `$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$linux$wday$tar $files`; } else { ### BACKUP OTHER CONF FILES ON THE SERVER ### - `$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$linux$wday$tar /etc/hosts /etc/rc.d/rc.local /etc/resolv.conf`; + $files = ""; + if ( -e ('/etc/hosts')) {$files += "/etc/hosts ";} + if ( -e ('/etc/rc.d/rc.local')) {$files += "/etc/rc.d/rc.local ";} + if ( -e ('/etc/resolv.conf')) {$files += "/etc/resolv.conf ";} + + `$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$linux$wday$tar $files`; } }